analyze-css
Advanced tools
Comparing version 0.11.1 to 0.12.0
@@ -18,5 +18,12 @@ /** | ||
var path = require('path'), | ||
sass = require('node-sass'), | ||
sass, | ||
out; | ||
// check the presense of the optional "node-sass" module (#118) | ||
try { | ||
sass = require('node-sass'); | ||
} catch (e) { | ||
throw new Error("Can't process SASS/SCSS, please run 'npm install node-sass'"); | ||
} | ||
var includeDir = path.dirname(options.file); | ||
@@ -23,0 +30,0 @@ debug('Using "%s" include path', includeDir); |
{ | ||
"name": "analyze-css", | ||
"version": "0.11.1", | ||
"version": "0.12.0", | ||
"author": "Maciej Brencz <maciej.brencz@gmail.com> (https://github.com/macbre)", | ||
@@ -18,3 +18,3 @@ "description": "CSS selectors complexity and performance analyzer", | ||
], | ||
"license": "BSD", | ||
"license": "BSD-2-Clause", | ||
"engines": { | ||
@@ -30,4 +30,3 @@ "node": ">=0.8" | ||
"glob": "7.0.x", | ||
"node-sass": "^3.4.2", | ||
"onecolor": "^2.5.0", | ||
"onecolor": "^3.0.0", | ||
"optimist": "0.6.x", | ||
@@ -34,0 +33,0 @@ "slick": "~1.12.1", |
@@ -5,2 +5,3 @@ /*global describe, it */ | ||
var analyzer = require('../'), | ||
isSassInstalled = true, | ||
assert = require('assert'), | ||
@@ -10,3 +11,37 @@ scss = 'nav {\nul{ color: white }\n}', | ||
describe('SASS preprocessor', function() { | ||
try { | ||
require('node-sass'); | ||
} catch (e) { | ||
isSassInstalled = false; | ||
} | ||
/** | ||
* TODO: install and test node-sass | ||
*/ | ||
function testSassInstalled(done) { | ||
new analyzer(sass, { | ||
preprocessor: 'sass' | ||
}, function(err, res) { | ||
assert.strictEqual(err, null); | ||
assert.equal(res.metrics.selectors, 1); | ||
done(); | ||
}); | ||
} | ||
/** | ||
* node-sass is not installed by default (see #118) | ||
*/ | ||
function testSassNotInstalled(done) { | ||
try { | ||
new analyzer(scss, { | ||
preprocessor: 'sass' | ||
}, function(err, res) {}); | ||
} catch (e) { | ||
assert.ok(e instanceof Error); | ||
assert.equal(e.message, 'Preprocessing failed: Error: Can\'t process SASS/SCSS, please run \'npm install node-sass\''); | ||
done(); | ||
} | ||
} | ||
describe('SASS preprocessor [' + (isSassInstalled ? 'node-sass installed' : 'node-sass missing') + ']', function() { | ||
it('should be chosen for SCSS files', function() { | ||
@@ -28,21 +63,5 @@ var preprocessors = new(require('../lib/preprocessors.js'))(); | ||
it('should generate CSS from SCSS correctly', function(done) { | ||
new analyzer(scss, { | ||
preprocessor: 'sass' | ||
}, function(err, res) { | ||
assert.strictEqual(err, null); | ||
assert.equal(res.metrics.selectors, 1); | ||
done(); | ||
}); | ||
}); | ||
it('should generate CSS from SCSS correctly', !isSassInstalled ? testSassNotInstalled : testSassInstalled); | ||
it('should generate CSS from SASS correctly', function(done) { | ||
new analyzer(sass, { | ||
preprocessor: 'sass' | ||
}, function(err, res) { | ||
assert.strictEqual(err, null); | ||
assert.equal(res.metrics.selectors, 1); | ||
done(); | ||
}); | ||
}); | ||
it('should generate CSS from SASS correctly', !isSassInstalled ? testSassNotInstalled : testSassInstalled); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
193206
10
0
4747
+ Addedonecolor@3.1.0(transitive)
- Removednode-sass@^3.4.2
- Removedabbrev@1.1.1(transitive)
- Removedajv@6.12.6(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedaproba@1.2.0(transitive)
- Removedare-we-there-yet@1.1.7(transitive)
- Removedarray-find-index@1.0.2(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasync-foreach@0.1.3(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedblock-stream@0.0.9(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removedcamelcase@2.1.13.0.0(transitive)
- Removedcamelcase-keys@2.1.0(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedchalk@1.1.3(transitive)
- Removedcliui@3.2.0(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedconsole-control-strings@1.1.0(transitive)
- Removedcore-util-is@1.0.21.0.3(transitive)
- Removedcross-spawn@3.0.1(transitive)
- Removedcurrently-unhandled@0.4.1(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddelegates@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedfind-up@1.1.2(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedfstream@1.0.12(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedgauge@2.7.4(transitive)
- Removedgaze@1.1.3(transitive)
- Removedget-caller-file@1.0.3(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedget-stdin@4.0.1(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedglob@7.1.77.2.3(transitive)
- Removedglobule@1.3.4(transitive)
- Removedgopd@1.0.1(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhas-unicode@2.0.1(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedin-publish@2.0.1(transitive)
- Removedindent-string@2.1.0(transitive)
- Removedinvert-kv@1.0.0(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedis-finite@1.1.0(transitive)
- Removedis-fullwidth-code-point@1.0.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedis-utf8@0.2.1(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjs-base64@2.6.4(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedlcid@1.0.0(transitive)
- Removedload-json-file@1.1.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlodash.assign@4.2.0(transitive)
- Removedlodash.clonedeep@4.5.0(transitive)
- Removedloud-rejection@1.6.0(transitive)
- Removedlru-cache@4.1.5(transitive)
- Removedmap-obj@1.0.1(transitive)
- Removedmeow@3.7.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedminimatch@3.0.8(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removednan@2.20.0(transitive)
- Removednode-gyp@3.8.0(transitive)
- Removednode-sass@3.13.1(transitive)
- Removednopt@3.0.6(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removednpmlog@4.1.2(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedobject.assign@4.1.5(transitive)
- Removedonecolor@2.5.0(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedos-locale@1.4.0(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedosenv@0.1.5(transitive)
- Removedparse-json@2.2.0(transitive)
- Removedpath-exists@2.1.0(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpath-type@1.1.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpify@2.3.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedpseudomap@1.0.2(transitive)
- Removedpsl@1.9.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedread-pkg@1.1.0(transitive)
- Removedread-pkg-up@1.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedredent@1.0.0(transitive)
- Removedrepeating@2.0.1(transitive)
- Removedrequest@2.88.2(transitive)
- Removedrequire-directory@2.1.1(transitive)
- Removedrequire-main-filename@1.0.1(transitive)
- Removedresolve@1.22.8(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsass-graph@2.2.6(transitive)
- Removedscss-tokenizer@0.2.3(transitive)
- Removedsemver@5.3.0(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedsource-map@0.4.4(transitive)
- Removedspdx-correct@3.2.0(transitive)
- Removedspdx-exceptions@2.5.0(transitive)
- Removedspdx-expression-parse@3.0.1(transitive)
- Removedspdx-license-ids@3.0.20(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedstring-width@1.0.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedstrip-bom@2.0.0(transitive)
- Removedstrip-indent@1.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedtar@2.2.2(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtrim-newlines@1.0.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removeduuid@3.4.0(transitive)
- Removedvalidate-npm-package-license@3.0.4(transitive)
- Removedverror@1.10.0(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwhich-module@1.0.0(transitive)
- Removedwide-align@1.1.5(transitive)
- Removedwrap-ansi@2.1.0(transitive)
- Removedy18n@3.2.2(transitive)
- Removedyallist@2.1.2(transitive)
- Removedyargs@7.1.2(transitive)
- Removedyargs-parser@5.0.1(transitive)
Updatedonecolor@^3.0.0