builder-amd-css
Advanced tools
Comparing version 0.0.4 to 0.0.5
49
index.js
@@ -1,2 +0,2 @@ | ||
var mutex, queue, requireCssFiles, | ||
var requireCssFiles, | ||
fs = require( "fs" ), | ||
@@ -8,3 +8,2 @@ glob = require( "glob" ), | ||
queue = []; | ||
requireCssFiles = {}; | ||
@@ -16,29 +15,5 @@ | ||
function enqueueBuildCss() { | ||
queue.push( arguments ); | ||
if ( queue.length === 1 ) { | ||
dequeueBuildCss(); | ||
} | ||
} | ||
function dequeueBuildCss() { | ||
var callback; | ||
var args = queue[ 0 ]; | ||
if ( args !== undefined ) { | ||
callback = args[ 2 ]; | ||
args[ 2 ] = function() { | ||
callback.apply( {}, arguments ); | ||
queue.shift(); | ||
dequeueBuildCss(); | ||
}; | ||
buildCss.apply( {}, args ); | ||
} | ||
} | ||
function buildCss( files, config, callback ) { | ||
var localCallback, include; | ||
var include; | ||
if ( mutex ) { | ||
return callback( new Error( "Concurrent calls not supported" ) ); | ||
} | ||
if ( typeof config !== "object" ) { | ||
@@ -50,7 +25,2 @@ return callback( new Error( "missing or invalid config (object expected)" ) ); | ||
} | ||
mutex = true; | ||
localCallback = function( error, css ) { | ||
mutex = false; | ||
callback( error, css, files ); | ||
}; | ||
@@ -98,6 +68,11 @@ include = config.include; | ||
requirejs.setFiles( files ); | ||
requirejs.optimize( config, function() { | ||
localCallback( null, files[ "dist/output.css" ] ); | ||
}, localCallback ); | ||
requirejs.setFiles( files, function( done ) { | ||
requirejs.optimize( config, function() { | ||
callback( null, files[ "dist/output.css" ], files ); | ||
done(); | ||
}, function( error ) { | ||
callback( error ); | ||
done(); | ||
}); | ||
}); | ||
} | ||
@@ -120,3 +95,3 @@ | ||
enqueueBuildCss( clonedFiles, config, callback ); | ||
buildCss( clonedFiles, config, callback ); | ||
}; |
{ | ||
"name": "builder-amd-css", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "index.js", | ||
@@ -29,3 +29,3 @@ "repository": { | ||
"glob": "4.3.5", | ||
"requirejs-memfiles": ">2.1.15-0 <=2.1.15" | ||
"requirejs-memfiles": ">=2.1.15-3 <=2.1.15" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
@@ -52,3 +52,3 @@ ## Why builder-amd-css? | ||
**requirejsConfig** *Object* [require.js build configuration][ | ||
**requirejsConfig** *Object* [require.js build configuration][]. | ||
@@ -55,0 +55,0 @@ **callback** *Function* called with three arguments: null or an Error object, a |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39745
706