Skip to content

Commit

Permalink
Added SCSS support to test unit
Browse files Browse the repository at this point in the history
  • Loading branch information
SonoIo committed Jun 21, 2016
1 parent 0d30cc8 commit dd258a4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/eve.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ program
if (err) return handleError(err, 'JS');
console.log('JS builded with mode '.gray + mode.cyan + '...'.gray + time.green + '\u0007');
});
scss(mode, function (err, time) {
scss(mode, unit, function (err, time) {
if (err) return handleError(err, 'SCSS');
console.log('SCSS builded...'.gray + time.green + '\u0007');
});
Expand Down Expand Up @@ -66,7 +66,7 @@ program
});
}
if (isCss) {
scss('dev', function (err, time) {
scss('dev', null, function (err, time) {
if (err) return handleError(err, 'SCSS');
prepareApp(function(err, platform) {
if (err) return handleError(err, 'CORDOVA');
Expand Down Expand Up @@ -115,7 +115,7 @@ program
});
}
if (isCss) {
scss('dev', function (err, time) {
scss('test', unit, function (err, time) {
if (err) return handleError(err, 'SCSS');
console.log('SCSS builded...'.gray + time.green + '\u0007');
});
Expand Down
7 changes: 6 additions & 1 deletion lib/scss.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ var sass = require('node-sass');
var path = require('path');
var fs = require('fs');

module.exports = function (mode, done) {
module.exports = function (mode, unit, done) {
var time = process.hrtime();

mode = mode || 'dev';

var outFile = path.resolve(path.join('build', 'assets', 'css', 'style.css'));
var mapFile = path.resolve(path.join('build', 'assets', 'css', 'style.css.map'));

if (mode == 'test') {
outFile = path.join('test', unit, 'style.css');
mapFile = path.join('test', unit, 'style.css.map');
}

sass.render({
file: path.resolve(path.join('styles', 'style.scss')),
sourceMap: mode != 'dist',
Expand Down
4 changes: 2 additions & 2 deletions lib/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = function (options, callback) {

var match = options.match || /\.(js|json|html|scss|css)$/;

var blackList = ['bundle.js'];
var blackList = ['bundle.js', 'style.css'];

var dirsAndFiles = [
'package.json',
Expand Down Expand Up @@ -37,7 +37,7 @@ module.exports = function (options, callback) {

function update(filename, ext) {
var isJs = ['.js', '.json', '.html'].indexOf(ext) !== -1;
var isCss = ['.css', '.scss'].indexOf(ext) !== -1;
var isCss = ['.scss'].indexOf(ext) !== -1;
callback(isJs, isCss);
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eve",
"version": "1.0.7",
"description": "Eve command line tools",
"description": "Eve command line tools for browserify projects",
"bin": {
"eve": "./lib/eve.js"
},
Expand Down

0 comments on commit dd258a4

Please sign in to comment.