Commit 5ab23fb3 by vagrant

CLI: Makes compilation data-first.

* Other minor fixes.
parent 5dd70318
...@@ -5,8 +5,7 @@ var Emitter = require('events').EventEmitter, ...@@ -5,8 +5,7 @@ var Emitter = require('events').EventEmitter,
meow = require('meow'), meow = require('meow'),
replaceExt = require('replace-ext'), replaceExt = require('replace-ext'),
stdin = require('get-stdin'), stdin = require('get-stdin'),
render = require('../lib/render'), render = require('../lib/render');
fs = require('fs');
/** /**
* Initialize CLI * Initialize CLI
...@@ -209,11 +208,10 @@ function run(options, emitter) { ...@@ -209,11 +208,10 @@ function run(options, emitter) {
} }
if (options.importer) { if (options.importer) {
if (fs.existsSync(options.importer)) { if ((path.resolve(options.importer) === path.normalize(options.importer).replace(/(.+)([\/|\\])$/, '$1'))) {
options.importer = require(options.importer); options.importer = require(options.importer);
} else { } else {
console.error('Could not locate importer.'); options.importer = require(path.resolve(process.cwd(), options.importer));
process.exit(1);
} }
} }
......
...@@ -26,10 +26,10 @@ module.exports = function(options, emitter) { ...@@ -26,10 +26,10 @@ module.exports = function(options, emitter) {
importer: options.importer importer: options.importer
}; };
if (options.src) { if (options.data) {
renderOptions.file = options.src;
} else if (options.data) {
renderOptions.data = options.data; renderOptions.data = options.data;
} else if (options.src) {
renderOptions.file = options.src;
} }
renderOptions.success = function(result) { renderOptions.success = function(result) {
......
var path = require('path'); var path = require('path');
module.exports = function(file) {console.log('>>>>>>>>>>');console.log(path.resolve(path.join(process.cwd(), 'test/fixtures/include-files/', file + (path.extname(file) ? '' : '.scss')))); module.exports = function(file) {
return { return {
file: path.resolve(path.join(process.cwd(), 'test/fixtures/include-files/', file + (path.extname(file) ? '' : '.scss'))) file: path.resolve(path.join(process.cwd(), 'test/fixtures/include-files/', file + (path.extname(file) ? '' : '.scss')))
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment