Socket
Socket
Sign inDemoInstall

analyze-css

Package Overview
Dependencies
Maintainers
1
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

analyze-css - npm Package Compare versions

Comparing version 0.11.1 to 0.12.0

9

lib/preprocessors/sass.js

@@ -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);

7

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc