gulp-compass
Advanced tools
Comparing version 1.1.8 to 1.1.9
@@ -1,30 +0,28 @@ | ||
(function() { | ||
'use strict'; | ||
'use strict'; | ||
/** | ||
* Plugins load | ||
*/ | ||
var gulp = require('gulp'), | ||
jshint = require('gulp-jshint'), | ||
mocha = require('gulp-mocha'), | ||
clean = require('gulp-clean'), | ||
reporter = require('jshint-stylish'); | ||
/** | ||
* Plugins load | ||
*/ | ||
var gulp = require('gulp'), | ||
jshint = require('gulp-jshint'), | ||
mocha = require('gulp-mocha'), | ||
clean = require('gulp-clean'), | ||
reporter = require('jshint-stylish'); | ||
gulp.task('hint', function () { | ||
return gulp.src(['**/*.js', '!node_modules/**/*']) | ||
.pipe(jshint()) | ||
.pipe(jshint.reporter(reporter)); | ||
}); | ||
gulp.task('hint', function () { | ||
return gulp.src(['**/*.js', '!node_modules/**/*']) | ||
.pipe(jshint()) | ||
.pipe(jshint.reporter(reporter)); | ||
}); | ||
gulp.task('mocha', function () { | ||
return gulp.src('test/*_test.js') | ||
.pipe(mocha({reporter: 'spec'})); | ||
}); | ||
gulp.task('mocha', ['clean'], function () { | ||
return gulp.src('test/*_test.js') | ||
.pipe(mocha({reporter: 'spec'})); | ||
}); | ||
gulp.task('clean', function () { | ||
return gulp.src('test/css', {read: false}) | ||
.pipe(clean()); | ||
}); | ||
gulp.task('clean', function () { | ||
return gulp.src('test/css', {read: false}) | ||
.pipe(clean()); | ||
}); | ||
gulp.task('default', ['hint', 'mocha']); | ||
})(); | ||
gulp.task('default', ['hint', 'mocha']); |
82
index.js
'use strict'; | ||
var fs = require('fs'), | ||
compass = require('./lib/compass'), | ||
through = require('through2'), | ||
gutil = require('gulp-util'), | ||
path = require('path'); | ||
compass = require('./lib/compass'), | ||
through = require('through2'), | ||
gutil = require('gulp-util'), | ||
path = require('path'); | ||
@@ -13,47 +13,47 @@ // Consts | ||
module.exports = function(opt) { | ||
var compile = function(file, enc, cb) { | ||
if (file.isNull()) { | ||
this.push(file); | ||
return cb(); | ||
} | ||
var compile = function(file, enc, cb) { | ||
if (file.isNull()) { | ||
this.push(file); | ||
return cb(); | ||
} | ||
if (file.isStream()) { | ||
this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported')); | ||
return cb(); | ||
} | ||
if (file.isStream()) { | ||
this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported')); | ||
return cb(); | ||
} | ||
if (path.basename(file.path)[0] === '_') { | ||
return cb(); | ||
} | ||
if (path.basename(file.path)[0] === '_') { | ||
return cb(); | ||
} | ||
compass(file.path, opt, function(code, stdout, stderr, path) { | ||
if (code === 127) { | ||
this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'You need to have Ruby and Compass installed ' + | ||
'and in your system PATH for this task to work. ')); | ||
return cb(); | ||
} | ||
compass(file.path, opt, function(code, stdout, stderr, path) { | ||
if (code === 127) { | ||
this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'You need to have Ruby and Compass installed ' + | ||
'and in your system PATH for this task to work. ')); | ||
return cb(); | ||
} | ||
// support error callback | ||
if (code !== 0) { | ||
this.emit('error', new gutil.PluginError(PLUGIN_NAME, stdout || 'Compass failed')); | ||
return cb(); | ||
} | ||
// support error callback | ||
if (code !== 0) { | ||
this.emit('error', new gutil.PluginError(PLUGIN_NAME, stdout || 'Compass failed')); | ||
return cb(); | ||
} | ||
// excute callback | ||
var pathToCss = gutil.replaceExtension(path, '.css'), | ||
contents = fs.readFileSync(pathToCss); | ||
// excute callback | ||
var pathToCss = gutil.replaceExtension(path, '.css'), | ||
contents = fs.readFileSync(pathToCss); | ||
// Fix garbled output. | ||
if (!(contents instanceof Buffer)) { | ||
contents = new Buffer(contents); | ||
} | ||
// Fix garbled output. | ||
if (!(contents instanceof Buffer)) { | ||
contents = new Buffer(contents); | ||
} | ||
file.path = gutil.replaceExtension(file.path, '.css'); | ||
file.contents = contents; | ||
this.push(file); | ||
cb(); | ||
}.bind(this)); | ||
}; | ||
file.path = gutil.replaceExtension(file.path, '.css'); | ||
file.contents = contents; | ||
this.push(file); | ||
cb(); | ||
}.bind(this)); | ||
}; | ||
return through.obj(compile); | ||
return through.obj(compile); | ||
}; |
'use strict'; | ||
var PLUGIN_NAME = 'gulp-compass', | ||
spawn = require('child_process').spawn, | ||
gutil = require('gulp-util'), | ||
path = require('path'), | ||
which = require('which').sync, | ||
defaults = { | ||
style: 'nested', | ||
comments: true, | ||
relative: true, | ||
css: 'css', | ||
sass: 'sass', | ||
image: 'images', | ||
javascript: 'js', | ||
font: 'font', | ||
import_path: false, | ||
config_file: false, | ||
require: false, | ||
logging: true, | ||
load_all: false, | ||
project: process.cwd(), | ||
bundle_exec: false, | ||
debug: false, | ||
time: false, | ||
sourcemap: false | ||
}, | ||
isArray = Array.isArray || function(obj) { | ||
return Object.prototype.toString.call(obj) === '[object Array]'; | ||
}; | ||
spawn = require('child_process').spawn, | ||
gutil = require('gulp-util'), | ||
path = require('path'), | ||
which = require('which').sync, | ||
defaults = { | ||
style: false, | ||
comments: true, | ||
relative: true, | ||
css: 'css', | ||
sass: 'sass', | ||
image: false, | ||
javascript: false, | ||
font: false, | ||
import_path: false, | ||
config_file: false, | ||
require: false, | ||
logging: true, | ||
load_all: false, | ||
project: process.cwd(), | ||
bundle_exec: false, | ||
debug: false, | ||
time: false, | ||
sourcemap: false, | ||
boring: false | ||
}, | ||
isArray = Array.isArray || function(obj) { | ||
return Object.prototype.toString.call(obj) === '[object Array]'; | ||
}; | ||
module.exports = function(file, opts, callback) { | ||
opts = opts || {}; | ||
opts = opts || {}; | ||
for (var key in defaults) { | ||
if (opts[key] === undefined) { | ||
opts[key] = defaults[key]; | ||
} | ||
for (var key in defaults) { | ||
if (opts[key] === undefined) { | ||
opts[key] = defaults[key]; | ||
} | ||
} | ||
var compassExecutable = 'compass', | ||
file_path = file.replace(/\\/g, '/'), | ||
relative_file_name = path.relative(path.join(opts.project || process.cwd(), opts.sass), file); | ||
var compassExecutable = 'compass', | ||
file_path = file.replace(/\\/g, '/'), | ||
relative_file_name = path.relative(path.join(opts.project || process.cwd(), opts.sass), file); | ||
// check command exist | ||
try { | ||
if (opts.bundle_exec) { | ||
compassExecutable = which('bundle'); | ||
} else { | ||
compassExecutable = which(compassExecutable); | ||
} | ||
} catch (err) { | ||
if(callback){ | ||
callback(127, '', String(err), ''); | ||
} | ||
return; | ||
} | ||
var options = []; | ||
// check command exist | ||
try { | ||
if (opts.bundle_exec) { | ||
options.push('exec', 'compass'); | ||
} | ||
options.push('compile'); | ||
if (process.platform === 'win32') { | ||
options.push(opts.project.replace(/\\/g, '/')); | ||
compassExecutable = which('bundle'); | ||
} else { | ||
options.push(opts.project); | ||
compassExecutable = which(compassExecutable); | ||
} | ||
options.push(file_path); | ||
} catch (err) { | ||
if(callback){ | ||
callback(127, '', String(err), ''); | ||
} | ||
return; | ||
} | ||
// set compass setting | ||
if (opts.config_file) { | ||
options.push('-c', opts.config_file); | ||
//Support for environment | ||
if (opts.environment) { options.push('--environment', opts.environment); } | ||
var options = []; | ||
if (opts.bundle_exec) { | ||
options.push('exec', 'compass'); | ||
} | ||
options.push('compile'); | ||
if (process.platform === 'win32') { | ||
options.push(opts.project.replace(/\\/g, '/')); | ||
} else { | ||
options.push(opts.project); | ||
} | ||
options.push(file_path); | ||
// set compass setting | ||
if (opts.environment) { options.push('--environment', opts.environment); } | ||
if (opts.config_file) { options.push('-c', opts.config_file); } | ||
if (!opts.comments) { options.push('--no-line-comments'); } | ||
if (opts.relative) { options.push('--relative-assets'); } | ||
if (opts.debug) { options.push('--debug-info'); } | ||
if (opts.time) { options.push('--time'); } | ||
if (opts.boring) { options.push('--boring'); } | ||
if (opts.sourcemap) { options.push('--sourcemap'); } | ||
if (opts.font) { options.push('--fonts-dir', opts.font); } | ||
if (opts.style) { options.push('--output-style', opts.style); } | ||
if (opts.image) { options.push('--images-dir', opts.image); } | ||
if (opts.javascript) { options.push('--javascripts-dir', opts.javascript); } | ||
options.push('--css-dir', opts.css); | ||
options.push('--sass-dir', opts.sass); | ||
if (opts.import_path) { | ||
if(isArray(opts.import_path)) { | ||
opts.import_path.forEach(function(i) { | ||
options.push('-I', i); | ||
}); | ||
} else { | ||
if (!opts.comments) { options.push('--no-line-comments'); } | ||
if (opts.relative) { options.push('--relative-assets'); } | ||
if (opts.debug) { options.push('--debug-info'); } | ||
if (opts.time) { options.push('--time'); } | ||
if (opts.sourcemap) { options.push('--sourcemap'); } | ||
options.push('--output-style', opts.style); | ||
options.push('--css-dir', opts.css); | ||
options.push('--sass-dir', opts.sass); | ||
options.push('--images-dir', opts.image); | ||
options.push('--javascripts-dir', opts.javascript); | ||
options.push('--fonts-dir', opts.font); | ||
if (opts.import_path) { | ||
if(isArray(opts.import_path)) { | ||
opts.import_path.forEach(function(i) { | ||
options.push('-I', i); | ||
}); | ||
} else { | ||
options.push('-I', opts.import_path); | ||
} | ||
} | ||
if (opts.load_all) { options.push('--load-all', opts.load_all); } | ||
if (opts.require) { | ||
if (isArray(opts.require)) { | ||
for (var i = 0, len = opts.require.length; i < len; i++) { | ||
options.push('--require', opts.require[i]); | ||
} | ||
} else { | ||
options.push('--require', opts.require); | ||
} | ||
} | ||
options.push('-I', opts.import_path); | ||
} | ||
if (opts.debug) { | ||
gutil.log(PLUGIN_NAME + ':', 'Running command:', compassExecutable, options.join(' ')); | ||
} | ||
if (opts.load_all) { options.push('--load-all', opts.load_all); } | ||
if (opts.require) { | ||
if (isArray(opts.require)) { | ||
for (var i = 0, len = opts.require.length; i < len; i++) { | ||
options.push('--require', opts.require[i]); | ||
} | ||
} else { | ||
options.push('--require', opts.require); | ||
} | ||
} | ||
var child = spawn(compassExecutable, options, {cwd: opts.project || process.cwd()}), | ||
stdout = '', | ||
stderr = ''; | ||
if (opts.logging) { | ||
child.stdout.setEncoding('utf8'); | ||
child.stdout.on('data', function (data) { | ||
stdout += data; | ||
console.log(data); | ||
}); | ||
if (opts.debug) { | ||
gutil.log(PLUGIN_NAME + ':', 'Running command:', compassExecutable, options.join(' ')); | ||
} | ||
child.stderr.setEncoding('utf8'); | ||
child.stderr.on('data', function (data) { | ||
stderr += data; | ||
if (!data.match(/^\u001b\[\d+m$/)) { | ||
gutil.log(data); | ||
} | ||
}); | ||
} | ||
var child = spawn(compassExecutable, options, {cwd: opts.project || process.cwd()}), | ||
stdout = '', | ||
stderr = ''; | ||
if (opts.logging) { | ||
child.stdout.setEncoding('utf8'); | ||
child.stdout.on('data', function (data) { | ||
stdout += data; | ||
console.log(data); | ||
}); | ||
// support callback | ||
child.on('close', function(code) { | ||
var new_path; | ||
new_path = path.join(opts.project, opts.css, relative_file_name); | ||
if(callback){ | ||
callback(code, stdout, stderr, new_path); | ||
} | ||
child.stderr.setEncoding('utf8'); | ||
child.stderr.on('data', function (data) { | ||
stderr += data; | ||
if (!data.match(/^\u001b\[\d+m$/)) { | ||
gutil.log(data); | ||
} | ||
}); | ||
} | ||
// support callback | ||
child.on('close', function(code) { | ||
var new_path; | ||
new_path = path.join(opts.project, opts.css, relative_file_name); | ||
if(callback){ | ||
callback(code, stdout, stderr, new_path); | ||
} | ||
}); | ||
}; |
{ | ||
"name": "gulp-compass", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "Compile Compass files", | ||
@@ -37,8 +37,8 @@ "main": "index.js", | ||
"iconv-lite": "~0.2.11", | ||
"gulp-jshint": "~1.5.0", | ||
"gulp-jshint": "^1.5.5", | ||
"jshint-stylish": "~0.1.5", | ||
"map-stream": "~0.1.0", | ||
"gulp": "~3.3.2", | ||
"gulp-mocha": "~0.3.0", | ||
"gulp-clean": "~0.2.4" | ||
"gulp": "^3.6.2", | ||
"gulp-mocha": "^0.4.1", | ||
"gulp-clean": "^0.2.4" | ||
}, | ||
@@ -45,0 +45,0 @@ "engines": { |
@@ -30,3 +30,3 @@ # Gulp compass [![NPM version](https://badge.fury.io/js/gulp-compass.png)](http://badge.fury.io/js/gulp-compass) [![Build Status](https://travis-ci.org/appleboy/gulp-compass.png?branch=master)](https://travis-ci.org/appleboy/gulp-compass) | ||
Please **make sure** to add ``css`` and ``sass`` options with the same value in ``config.rb``. | ||
Please **make sure** to add ``css`` and ``sass`` options with the same value in ``config.rb`` since ``compass`` can't output css result directly. | ||
@@ -40,9 +40,9 @@ * ``css`` default value is ``css``. | ||
gulp.task('compass', function() { | ||
gulp.src('./src/*.scss') | ||
.pipe(compass({ | ||
config_file: './config.rb', | ||
css: 'stylesheets' | ||
sass: 'sass' | ||
})) | ||
.pipe(gulp.dest('app/assets/temp')); | ||
gulp.src('./src/*.scss') | ||
.pipe(compass({ | ||
config_file: './config.rb', | ||
css: 'stylesheets', | ||
sass: 'sass' | ||
})) | ||
.pipe(gulp.dest('app/assets/temp')); | ||
}); | ||
@@ -57,12 +57,12 @@ ``` | ||
var compass = require('gulp-compass'), | ||
path = require('path'); | ||
path = require('path'); | ||
gulp.task('compass', function() { | ||
gulp.src('./src/*.scss') | ||
.pipe(compass({ | ||
project: path.join(__dirname, 'assets'), | ||
css: 'css', | ||
sass: 'sass' | ||
})) | ||
.pipe(gulp.dest('app/assets/temp')); | ||
gulp.src('./src/*.scss') | ||
.pipe(compass({ | ||
project: path.join(__dirname, 'assets'), | ||
css: 'css', | ||
sass: 'sass' | ||
})) | ||
.pipe(gulp.dest('app/assets/temp')); | ||
}); | ||
@@ -75,13 +75,13 @@ ``` | ||
var compass = require('gulp-compass'), | ||
minifyCSS = require('gulp-minify-css'); | ||
minifyCSS = require('gulp-minify-css'); | ||
gulp.task('compass', function() { | ||
gulp.src('./src/*.scss') | ||
.pipe(compass({ | ||
css: 'app/assets/css', | ||
sass: 'app/assets/sass', | ||
image: 'app/assets/images' | ||
})) | ||
.pipe(minifyCSS()) | ||
.pipe(gulp.dest('app/assets/temp')); | ||
gulp.src('./src/*.scss') | ||
.pipe(compass({ | ||
css: 'app/assets/css', | ||
sass: 'app/assets/sass', | ||
image: 'app/assets/images' | ||
})) | ||
.pipe(minifyCSS()) | ||
.pipe(gulp.dest('app/assets/temp')); | ||
}); | ||
@@ -94,14 +94,14 @@ ``` | ||
var compass = require('gulp-compass'), | ||
minifyCSS = require('gulp-minify-css'); | ||
minifyCSS = require('gulp-minify-css'); | ||
gulp.task('compass', function() { | ||
gulp.src('./src/*.scss') | ||
.pipe(compass({ | ||
css: 'app/assets/css', | ||
sass: 'app/assets/sass', | ||
image: 'app/assets/images', | ||
require: ['susy', 'modular-scale'] | ||
})) | ||
.pipe(minifyCSS()) | ||
.pipe(gulp.dest('app/assets/temp')); | ||
gulp.src('./src/*.scss') | ||
.pipe(compass({ | ||
css: 'app/assets/css', | ||
sass: 'app/assets/sass', | ||
image: 'app/assets/images', | ||
require: ['susy', 'modular-scale'] | ||
})) | ||
.pipe(minifyCSS()) | ||
.pipe(gulp.dest('app/assets/temp')); | ||
}); | ||
@@ -114,16 +114,16 @@ ``` | ||
var compass = require('gulp-compass'), | ||
minifyCSS = require('gulp-minify-css'); | ||
minifyCSS = require('gulp-minify-css'); | ||
gulp.task('compass', function() { | ||
gulp.src('./src/*.scss') | ||
.pipe(compass({ | ||
css: 'app/assets/css', | ||
sass: 'app/assets/sass', | ||
image: 'app/assets/images' | ||
})) | ||
.on('error', function(err) { | ||
// Would like to catch the error here | ||
}) | ||
.pipe(minifyCSS()) | ||
.pipe(gulp.dest('app/assets/temp')); | ||
gulp.src('./src/*.scss') | ||
.pipe(compass({ | ||
css: 'app/assets/css', | ||
sass: 'app/assets/sass', | ||
image: 'app/assets/images' | ||
})) | ||
.on('error', function(err) { | ||
// Would like to catch the error here | ||
}) | ||
.pipe(minifyCSS()) | ||
.pipe(gulp.dest('app/assets/temp')); | ||
}); | ||
@@ -130,0 +130,0 @@ ``` |
'use strict'; | ||
var fs = require('fs'), | ||
compass = require('../lib/compass'), | ||
path = require('path'), | ||
gutil = require('gulp-util'), | ||
iconv = require('iconv-lite'); | ||
compass = require('../lib/compass'), | ||
path = require('path'), | ||
gutil = require('gulp-util'), | ||
iconv = require('iconv-lite'); | ||
@@ -12,230 +12,251 @@ require('mocha'); | ||
var read_file = function(filepath) { | ||
var contents; | ||
try { | ||
contents = fs.readFileSync(String(filepath)); | ||
contents = iconv.decode(contents, 'utf-8'); | ||
// Strip any BOM that might exist. | ||
if (contents.charCodeAt(0) === 0xFEFF) { | ||
contents = contents.substring(1); | ||
} | ||
return contents; | ||
} catch(e) { | ||
throw new Error('Unable to read "' + filepath + '" file'); | ||
var contents; | ||
try { | ||
contents = fs.readFileSync(String(filepath)); | ||
contents = iconv.decode(contents, 'utf-8'); | ||
// Strip any BOM that might exist. | ||
if (contents.charCodeAt(0) === 0xFEFF) { | ||
contents = contents.substring(1); | ||
} | ||
return contents; | ||
} catch(e) { | ||
throw new Error('Unable to read "' + filepath + '" file'); | ||
} | ||
}; | ||
describe('gulp-compass plugin', function() { | ||
describe('compass()', function() { | ||
this.timeout(60000); | ||
var process = 0, timer, name_list = []; | ||
before(function(done){ | ||
compass(path.join(__dirname, 'sass/compile.scss'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
css: 'css', | ||
sass: 'sass', | ||
logging: false | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
describe('compass()', function() { | ||
this.timeout(60000); | ||
var process = 0, timer, name_list = []; | ||
before(function(done){ | ||
compass(path.join(__dirname, 'sass/compile.scss'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
css: 'css', | ||
sass: 'sass', | ||
logging: false | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/simple.sass'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
css: 'css', | ||
sass: 'sass', | ||
logging: false | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile sass error'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/simple.sass'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
css: 'css', | ||
sass: 'sass', | ||
logging: false | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile sass error'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/base/compile.scss'), { | ||
project: __dirname, | ||
config_file: path.join(__dirname, 'config.rb') | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with config.rb file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/base/compile.scss'), { | ||
project: __dirname, | ||
config_file: path.join(__dirname, 'config.rb') | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with config.rb file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/base/compile2.scss'), { | ||
project: __dirname, | ||
config_file: path.join(__dirname, 'config.rb'), | ||
environment: 'development' | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with config.rb file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/base/compile2.scss'), { | ||
project: __dirname, | ||
config_file: path.join(__dirname, 'config.rb'), | ||
environment: 'development' | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with config.rb file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/import.scss'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
import_path: 'bower_components' | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with import.scss file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/base/compile3.scss'), { | ||
project: __dirname, | ||
config_file: path.join(__dirname, 'config.rb'), | ||
style: 'expanded' | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with config.rb file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/import2.scss'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
import_path: ['bower_components', 'bower_components2'] | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with import.scss file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/import.scss'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
import_path: 'bower_components' | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with import.scss file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/require.scss'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
require: 'susy' | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with require.scss file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/import2.scss'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
import_path: ['bower_components', 'bower_components2'] | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with import.scss file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/spriting.scss'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
css: 'css', | ||
sass: 'sass', | ||
image: 'images', | ||
relative: true | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with spriting.scss file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/require.scss'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
require: 'susy' | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with require.scss file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/multiple-require.scss'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
require: ['susy', 'modular-scale'] | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with multiple require.scss file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
compass(path.join(__dirname, 'sass/spriting.scss'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
css: 'css', | ||
sass: 'sass', | ||
image: 'images', | ||
relative: true | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with spriting.scss file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
timer = setInterval(function(){ | ||
if (process === 9) { | ||
clearInterval(timer); | ||
done(); | ||
} | ||
}, 100); | ||
}); | ||
compass(path.join(__dirname, 'sass/multiple-require.scss'), { | ||
project: __dirname, | ||
style: 'compressed', | ||
require: ['susy', 'modular-scale'] | ||
}, function(code, stdout, stderr, new_path){ | ||
if (+code !== 0) { | ||
throw new Error('compile scss error with multiple require.scss file'); | ||
} | ||
new_path = gutil.replaceExtension(new_path, '.css'); | ||
name_list.push(path.relative(__dirname, new_path).replace(/\\/g, '/')); | ||
process += 1; | ||
}); | ||
it('compile scss to css', function() { | ||
var actual, expected; | ||
timer = setInterval(function(){ | ||
if (process === 9) { | ||
clearInterval(timer); | ||
done(); | ||
} | ||
}, 100); | ||
}); | ||
actual = read_file(path.join(__dirname, 'css/compile.css')); | ||
expected = read_file(path.join(__dirname, 'expected/compile.css')); | ||
actual.should.equal(expected); | ||
}); | ||
it('compile scss to css', function() { | ||
var actual, expected; | ||
it('compile sass to css', function() { | ||
var actual, expected; | ||
actual = read_file(path.join(__dirname, 'css/compile.css')); | ||
expected = read_file(path.join(__dirname, 'expected/compile.css')); | ||
actual.should.equal(expected); | ||
}); | ||
actual = read_file(path.join(__dirname, 'css/simple.css')); | ||
expected = read_file(path.join(__dirname, 'expected/simple.css')); | ||
actual.should.equal(expected); | ||
}); | ||
it('compile sass to css', function() { | ||
var actual, expected; | ||
it('test releate path with config.rb config', function() { | ||
var actual, expected; | ||
actual = read_file(path.join(__dirname, 'css/simple.css')); | ||
expected = read_file(path.join(__dirname, 'expected/simple.css')); | ||
actual.should.equal(expected); | ||
}); | ||
actual = read_file(path.join(__dirname, 'css/base/compile.css')); | ||
expected = read_file(path.join(__dirname, 'expected/compile.css')); | ||
actual.should.equal(expected); | ||
}); | ||
it('test releate path with config.rb config', function() { | ||
var actual, expected; | ||
it('test import_path option', function() { | ||
var actual, expected; | ||
actual = read_file(path.join(__dirname, 'css/base/compile.css')); | ||
expected = read_file(path.join(__dirname, 'expected/compile.css')); | ||
actual.should.equal(expected); | ||
}); | ||
actual = read_file(path.join(__dirname, 'css/import.css')); | ||
expected = read_file(path.join(__dirname, 'expected/import.css')); | ||
actual.should.equal(expected); | ||
}); | ||
it('test import_path option', function() { | ||
var actual, expected; | ||
it('test import_path array option', function() { | ||
var actual, expected; | ||
actual = read_file(path.join(__dirname, 'css/import.css')); | ||
expected = read_file(path.join(__dirname, 'expected/import.css')); | ||
actual.should.equal(expected); | ||
}); | ||
actual = read_file(path.join(__dirname, 'css/import2.css')); | ||
expected = read_file(path.join(__dirname, 'expected/import2.css')); | ||
actual.should.equal(expected); | ||
}); | ||
it('test import_path array option', function() { | ||
var actual, expected; | ||
it('test require option', function() { | ||
var actual, expected; | ||
actual = read_file(path.join(__dirname, 'css/import2.css')); | ||
expected = read_file(path.join(__dirname, 'expected/import2.css')); | ||
actual.should.equal(expected); | ||
}); | ||
actual = read_file(path.join(__dirname, 'css/require.css')); | ||
expected = read_file(path.join(__dirname, 'expected/require.css')); | ||
actual.should.equal(expected); | ||
}); | ||
it('test require option', function() { | ||
var actual, expected; | ||
it('test spriting with compass', function() { | ||
var actual, expected; | ||
actual = read_file(path.join(__dirname, 'css/require.css')); | ||
expected = read_file(path.join(__dirname, 'expected/require.css')); | ||
actual.should.equal(expected); | ||
}); | ||
actual = read_file(path.join(__dirname, 'css/spriting.css')); | ||
expected = read_file(path.join(__dirname, 'expected/spriting.css')); | ||
actual.should.equal(expected); | ||
}); | ||
it('test spriting with compass', function() { | ||
var actual, expected; | ||
it('test multiple require option', function() { | ||
var actual, expected; | ||
actual = read_file(path.join(__dirname, 'css/spriting.css')); | ||
expected = read_file(path.join(__dirname, 'expected/spriting.css')); | ||
actual.should.equal(expected); | ||
}); | ||
actual = read_file(path.join(__dirname, 'css/multiple-require.css')); | ||
expected = read_file(path.join(__dirname, 'expected/require.css')); | ||
actual.should.equal(expected); | ||
}); | ||
it('test multiple require option', function() { | ||
var actual, expected; | ||
it('test environment option', function() { | ||
var actual, expected; | ||
actual = read_file(path.join(__dirname, 'css/multiple-require.css')); | ||
expected = read_file(path.join(__dirname, 'expected/require.css')); | ||
actual.should.equal(expected); | ||
}); | ||
actual = read_file(path.join(__dirname, 'css/base/compile2.css')); | ||
expected = read_file(path.join(__dirname, 'expected/compile2.css')); | ||
actual.should.equal(expected); | ||
}); | ||
it('test environment option', function() { | ||
var actual, expected; | ||
it('output path test array', function() { | ||
var expected = ['css/base/compile.css', 'css/base/compile2.css', 'css/compile.css', 'css/import.css', 'css/import2.css', 'css/multiple-require.css', 'css/require.css', 'css/simple.css', 'css/spriting.css']; | ||
name_list.sort().should.eql(expected); | ||
}); | ||
actual = read_file(path.join(__dirname, 'css/base/compile2.css')); | ||
expected = read_file(path.join(__dirname, 'expected/compile2.css')); | ||
actual.should.equal(expected); | ||
}); | ||
it('test config_file option and overwrite output style', function() { | ||
var actual, expected; | ||
actual = read_file(path.join(__dirname, 'css/base/compile3.css')); | ||
expected = read_file(path.join(__dirname, 'expected/compile2.css')); | ||
actual.should.equal(expected); | ||
}); | ||
it('output path test array', function() { | ||
var expected = ['css/base/compile.css', 'css/base/compile2.css', 'css/base/compile3.css', 'css/compile.css', 'css/import.css', 'css/import2.css', 'css/multiple-require.css', 'css/require.css', 'css/simple.css', 'css/spriting.css']; | ||
name_list.sort().should.eql(expected); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
2005108
191
664
148