Commit cc7f166e by Иван Кубота

scss import error handling

parent b5e48fae
......@@ -118,6 +118,7 @@ var transformServe = function(dir, anything) {
let fixedUrl;
let serve = function (req, res, next) {
var qRes = res;
if (req.url in cache) {
return res.end(cache[req.url])
}
......@@ -162,8 +163,12 @@ var transformServe = function(dir, anything) {
if(err){
fs.readFile(fName = name+'.css', function(err, res) {
if(err){
done( false);
//throw new Error('what the fuck');
var origEnd = qRes.end;
qRes.end = function(data) {
console.error(data);
origEnd.call(qRes, data)
};
done(new Error('Can not resolve dependency!'))
}else{ thisOne(fName, res+'') }
})
}else{ thisOne(fName, res+'') }
......@@ -329,11 +334,13 @@ var doUpdate = async function(){
var files = [];
for( let filename in debounce ){
try{
if(filename.substr(-4)==='.jsx'){
var code = await readFile( filename ) + '';
var url = '/'+path.relative( './src', filename ).replace(/\\/g, '/')
console.log('Live transform jsx ',url)
var url = '/' + path.relative( './src', filename ).replace( /\\/g, '/' )
console.log( 'Live transform jsx ', url )
var result = await transformJSXPromised( code, url );
files.push( { file: url, content: result.code } );
}
}catch( e ){
console.log( 'Error in ' + e );
......
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