Questions tagged [uglifycss]

UglifyCSS is a port of YUI Compressor, for its CSS part, to NodeJS. Its name is a reference to UglifyJS but UglifyCSS is not a CSS parser. Like YUI CSS Compressor, it applies many regexp replacements.

UglifyCSS is a port of YUI Compressor () to NodeJS () for its CSS part. Its name is a reference to the awesome UglifyJS () but UglifyCSS is not a CSS parser. Like YUI CSS Compressor, it applies many regexp replacements. Note that a port to JavaScript is also available in the YUI Compressor repository.

UglifyCSS passes successfully the test suite of YUI compressor CSS.

Be sure to submit valid CSS to UglifyCSS or you could get weird results.


Command line

$ uglifycss [options] [filename] [...] > output

Options:

  • --max-line-len n adds a newline (approx.) every n characters; 0 means no newline and is the default value
  • --expand-vars expands variables; by default, @variables blocks are preserved and var(x)s are not expanded
  • --ugly-comments removes newlines within preserved comments; by default, newlines are preserved
  • --cute-comments preserves newlines within and around preserved comments If no file name is specified, input is read from stdin.

API

2 functions are provided:

  • processString( content, options ) to process a given string
  • processFiles( [ filename1, ... ], options ) to process the concatenation of given files

Options are identical to the command line:

  • <int> maxLineLen for --max-line-len n
  • <bool> expandVars for --expand-vars
  • <bool> uglyComments for --ugly-comments
  • <bool> cuteComments for --cute-comments

Both functions return uglified css.

Example

var uglifycss = require('uglifycss');

var uglified = uglifycss.processFiles(
    [ 'file1', 'file2' ],
    { maxLineLen: 500, expandVars: true }
);

console.log(uglified);
17 questions
5
votes
3 answers

Assetic dump does not find uglifycss in my Symfony app

For my prod environment I want to use the UglifyCSS filter configured as follows (config_prod.yml): assetic: filters: uglifycss: node: /usr/bin/env node bin: /usr/local/bin/uglifycss apply_to:…
acme
  • 14,654
  • 7
  • 75
  • 109
4
votes
1 answer

Symfony 2 assetic:dump UglifyCss causes [Symfony\Component\Process\Exception\RuntimeException] The process has been signaled with signal "5"

I'm developing my first Symfony 2 app, and I'm trying Uglify to minimize my .css files. The problem is that when I execute the command: $ /Applications/mampstack-5.4.17-0/php/bin/php app/console assetic:dump --verbose I get the following…
DaniDeveloper
  • 41
  • 1
  • 2
2
votes
1 answer

php-fpm forever respawning children when executing uglifycss

I have such line in a php application: exec('uglifycss 1.css 2.css > main.css'); After executing it, php-fpm starts to restart all children non stopping, which leads to 100% cpu on a server in seconds. Only service php-fpm restart saves the…
Sam Ivichuk
  • 999
  • 1
  • 10
  • 22
2
votes
1 answer

The combined file is not being included in production

I'm using uglifyjs and uglifycss with symfony to manage my asset. I have a strange issue. Here is my configuration # Assetic Configuration assetic: debug: "%kernel.debug%" use_controller: false bundles: [ ] …
Genoud Magloire
  • 555
  • 6
  • 15
2
votes
0 answers

UglifyJS and UglifyCSS Symfony2 assetics

I have some troubles making UglifyCSS and UglifyJS works with Assetics on my Symfony2.6 app. I simplified a little the problem for the moment (I properly checked that I still meet the issue with this config). I import my stylesheet in my base twig…
Théo
  • 655
  • 7
  • 17
2
votes
1 answer

How to know what version of UglifyCSS was installed?

I has installed UglifyCSS globally with command: npm install -g uglifycss How can I get current version of installed UglifyCSS? P.S. Version of UglifyJS I check with command: uglifyjs -V But when I try similar command for UglifyCSS: uglifycss…
Victor Bocharsky
  • 11,930
  • 13
  • 58
  • 91
2
votes
0 answers

Symfony2 + Assetic cache buster generating dead links in prod

I've been having problems getting the Assetic cache buster up and running on our production server. Symfony2 (2.4) is configured to use the cache buster only when in production. Everything works like a charm on our development machines. On the…
Niko
  • 66
  • 5
1
vote
2 answers

Change file extension while generating output file using uglifycss

I am using the uglifycss npm package to minify all the CSS files from the project output directory. I am executing the following post-build script to minify the CSS files content and rename the files by appending *.min.css find dist/assets/css/…
Suhaib Janjua
  • 3,538
  • 16
  • 59
  • 73
1
vote
1 answer

Uglifycss error when I do assetic:dump

when I try to do the php app/console assetic:dump --env=prod on Symfony I get the following exception: [Assetic\Exception\FilterException] An error occurred while running: '/usr/bin/nodejs' '/usr/local/bin/uglifycss'…
Sermanes
  • 496
  • 8
  • 22
1
vote
0 answers

Sylius - browser not loading latest version of my CSS file

We have a Sylius stack where we have installed uglify for minifying CSS and JS files. Since then, some of us in the team are facing issues with the browser not getting the latest version of the assets files. In my web/CSS I do see the latest version…
ilrock
  • 573
  • 8
  • 24
1
vote
0 answers

CSSO breaking keyframe code for IE

CSSO generating code that IE can't deal with. My simple @keyframes code: @keyframes star-pulsing { 0% { transform: scale(1); border: 2px solid @brand-primary; } 20%, 40% { transform: scale(1.3); background-color: #FFFFFF; …
Pikachu
  • 1,973
  • 3
  • 20
  • 27
1
vote
2 answers

CSS uglify — Grunt task

I wonder are there any Grunt tasks which uglify CSS? Like in GMail code — all class names are random 2-3 letters. I'm using AngularJS and grunt-angular-templates Grunt task to concatenate all templates in views/ folder to a single templates.js…
artuska
  • 864
  • 2
  • 12
  • 23
0
votes
1 answer

uglifycss changes background color when minified

When I run the script to minify my css file using uglifycss the background color changes in the minified file. What can i do to make sure this doesn't happen? filename.css: {.... background: #bfaaaff ...} filename.min.css: ...;background:#bf;...
Amit
  • 1
0
votes
1 answer

When applying the uglifycss to my css, all my @media and @font-face declarations are lost

I use the following block in my base twig template, to create the compressed css files: {% stylesheets output='bundles/myBundle/compressed/compressed.css' filter='uglifycss' filter='cssrewrite' …
Dominik
  • 141
  • 1
  • 3
  • 14
0
votes
1 answer

Problems minifying/aggregating CSS/JS files with Symfony 2.5 and UglifyCSS/JS

I have followed these instructions in order to enable both UglifyJs2 and UglifyCss on my development environment (to start with... can't risk taking down the production server with this problem!) Under my config_dev.yml I have configured the…
sjagr
  • 15,983
  • 5
  • 40
  • 67
1
2