From 2dd0030431dfc7e45138a4ea27e610b2b20ebb0f Mon Sep 17 00:00:00 2001 From: GoalSmashers Date: Sat, 22 Dec 2012 18:49:23 +0100 Subject: [PATCH] Cleaned up build & test system. * Moved Makefile tasks to npm scripts. * Use `npm run bench` to run benchmarks. * Use `npm run check` to run JSHint checks. * Use `npm test` to run tests on all platforms. * JSHint is being run every time before publishing code to npm repository. * Updated docs. --- Makefile | 19 ------------------- README.md | 23 ++++++++++++----------- package.json | 5 ++++- test.bat | 9 --------- 4 files changed, 16 insertions(+), 40 deletions(-) delete mode 100644 Makefile delete mode 100644 test.bat diff --git a/Makefile b/Makefile deleted file mode 100644 index 6092b989..00000000 --- a/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -TEST_DIR = test -VOWS = ./node_modules/.bin/vows -JSHINT = ./node_modules/.bin/jshint - -all: test - -test: - @@echo "Running all tests via vows..." - @@${VOWS} ${TEST_DIR}/*-test.js - -bench: - @@echo "Running benchmark on big.css file..." - @@node test/bench.js - -check: - @@echo "Running JSHint on all project files..." - @@${JSHINT} . - -.PHONY: all test bench check \ No newline at end of file diff --git a/README.md b/README.md index 4795d194..e3c7c2a9 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Clean-css is a node.js library for minifying CSS files. It does the same job as npm install clean-css -### How to use clean-css? ### +### How to use clean-css CLI? ### To minify a **public.css** file into **public-min.css** do: @@ -37,17 +37,27 @@ Or even gzip the result at once: cat one.css two.css three.css | cleancss | gzip -9 -c > merged-minified-and-gzipped.css.gz ### How to use clean-css programmatically? ### + ```javascript var cleanCSS = require('clean-css'); var source = "a{font-weight:bold;}"; var minimized = cleanCSS.process(source); ``` + Process method accepts a hash as a second parameter (i.e. `cleanCSS.process(source, options)`), with the following options available: * `keepSpecialComments` - `*` for keeping all (default), `1` for keeping first one, `0` for removing all * `keepBreaks` - whether to keep line breaks (default is false) * `removeEmpty` - whether to remove empty elements (default is false) -* `debug` - turns on debug mode (measuring time spent on cleaning up - run `make bench` to see example) +* `debug` - turns on debug mode (measuring time spent on cleaning up - run `npm run bench` to see example) + +### What are the clean-css' dev commands? ### + +First clone the source, then run: + +* `npm run bench` for clean-css benchmarks (see test/bench,js for details) +* `npm run check` to check JS sources with JSHint +* `npm test` for the test suite ### How do you preserve a comment block? ### @@ -57,15 +67,6 @@ Use `/*!` notation instead of standard one (i.e. `/*`): Important comments included in minified output. */ -### How to run clean-css tests? ### - -First clone the source, then run: - - npm test - -on *nix systems. If you are under Windows then run: - - test.bat ## Acknowledgments ## diff --git a/package.json b/package.json index 692ecf45..937a0f2b 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,10 @@ "cleancss": "./bin/cleancss" }, "scripts": { - "test": "node_modules/.bin/vows test/*-test.js" + "bench": "node test/bench.js", + "check": "jshint .", + "prepublish": "jshint .", + "test": "vows" }, "dependencies": { "optimist": "0.3.x" diff --git a/test.bat b/test.bat deleted file mode 100644 index a1770b62..00000000 --- a/test.bat +++ /dev/null @@ -1,9 +0,0 @@ -@echo off - -pushd %~dp0 - -node .\node_modules\vows\bin\vows test\batch-test.js test\binary-test.js test\custom-test.js test\unit-test.js - -popd - -pause -- 2.34.1