See #801 - recommends clean-css styles concatenation.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 27 Dec 2016 13:31:10 +0000 (14:31 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 27 Dec 2016 13:36:52 +0000 (14:36 +0100)
Why:

* There is a difference between passing in a concatenated string
  and letting clean-css do the job. The former will discard
  `@import` statements appearing not at the beginning of the string,
  while the latter will discard only those appearing not at
  the beginning of any of the files. Because of this behavior,
  the latter way is recommended.

README.md
bin/cleancss
test/binary-test.js

index 27df2a5..ff76c59 100644 (file)
--- a/README.md
+++ b/README.md
@@ -83,37 +83,32 @@ cleancss [options] source-file, [source-file, ...]
 
 #### Examples:
 
-To minify a **public.css** file into **public-min.css** do:
+To minify a **one.css** file into **one-min.css** do:
 
 ```
-cleancss -o public-min.css public.css
+cleancss -o one-min.css one.css
 ```
 
-To minify the same **public.css** into the standard output skip the `-o` parameter:
+To minify the same **one.css** into the standard output skip the `-o` parameter:
 
 ```
-cleancss public.css
+cleancss one.css
 ```
 
-More likely you would like to concatenate a couple of files.
-If you are on a Unix-like system:
+If you would like to minify a couple of files together, pass more paths in:
 
 ```bash
-cat one.css two.css three.css | cleancss -o merged-and-minified.css
+cleancss -o merged-and-minified.css one.css two.css three.css
 ```
 
-On Windows:
-
-```bat
-type one.css two.css three.css | cleancss -o merged-and-minified.css
-```
-
-Or even gzip the result at once:
+You can also pipe results to other commands, e.g. gzip:
 
 ```bash
-cat one.css two.css three.css | cleancss | gzip -9 -c > merged-minified-and-gzipped.css.gz
+cleancss one.css two.css three.css | gzip -9 -c > merged-minified-and-gzipped.css.gz
 ```
 
+Please note there is a difference between passing in a concatenated string and letting clean-css do the job. The former will discard `@import` statements appearing [not at the beginning](https://developer.mozilla.org/en-US/docs/Web/CSS/@import) of the string, while the latter will discard only those appearing not at the beginning of any of the files. Because of this behavior, the latter way (see examples above) is recommended.
+
 ### How to use clean-css API?
 
 ```js
index 27136aa..b936be3 100755 (executable)
@@ -9,8 +9,6 @@ var commands = require('commander');
 var packageConfig = fs.readFileSync(path.join(path.dirname(fs.realpathSync(process.argv[1])), '../package.json'));
 var buildVersion = JSON.parse(packageConfig).version;
 
-var isWindows = process.platform == 'win32';
-
 // Specify commander options to parse command line params correctly
 commands
   .version(buildVersion, '-v, --version')
@@ -39,12 +37,8 @@ commands.on('--help', function () {
   console.log('  Examples:\n');
   console.log('    %> cleancss one.css');
   console.log('    %> cleancss -o one-min.css one.css');
-  if (isWindows) {
-    console.log('    %> type one.css two.css three.css | cleancss -o merged-and-minified.css');
-  } else {
-    console.log('    %> cat one.css two.css three.css | cleancss -o merged-and-minified.css');
-    console.log('    %> cat one.css two.css three.css | cleancss | gzip -9 -c > merged-minified-and-gzipped.css.gz');
-  }
+  console.log('    %> cleancss -o merged-and-minified.css one.css two.css three.css');
+  console.log('    %> cleancss one.css two.css three.css | gzip -9 -c > merged-minified-and-gzipped.css.gz');
   console.log('');
   process.exit();
 });
index ce8d408..01d67b2 100644 (file)
@@ -64,10 +64,10 @@ vows.describe('./bin/cleancss')
         assert.include(stdout, 'cleancss -o one-min.css one.css');
       },
       'should output multiple files example': function (error, stdout) {
-        assert.include(stdout, 'cat one.css two.css three.css | cleancss -o merged-and-minified.css');
+        assert.include(stdout, 'cleancss -o merged-and-minified.css one.css two.css three.css');
       },
       'should output gzipping multiple files example': function (error, stdout) {
-        assert.include(stdout, 'cat one.css two.css three.css | cleancss | gzip -9 -c > merged-minified-and-gzipped.css.gz');
+        assert.include(stdout, 'cleancss one.css two.css three.css | gzip -9 -c > merged-minified-and-gzipped.css.gz');
       }
     })
   })