Add production dependencies
This commit is contained in:
parent
5a0114f3e2
commit
579ccdc29f
12113 changed files with 978046 additions and 3 deletions
52
node_modules/parse-import/index.js
generated
vendored
Normal file
52
node_modules/parse-import/index.js
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
'use strict';
|
||||
|
||||
var getImports = require('get-imports');
|
||||
|
||||
/**
|
||||
* Get path from @import
|
||||
*
|
||||
* @param {String} str
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function path(str) {
|
||||
return /(?:url\()(?:.*?)(?:\))|(["\'])(?:[^"\')]+)\1/ig.exec(str)[0]
|
||||
.replace(/(?:url\()/ig, '')
|
||||
.replace(/(?:\))/g, '')
|
||||
.replace(/(?:["\'])/g, '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get condition from @import
|
||||
*
|
||||
* @param {String} str
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function condition(str) {
|
||||
return str.replace(/(?:url\()(?:.*?)(?:\))|(["\'])(?:[^"\')]+)\1/ig, '')
|
||||
.replace(/(?:@import)(?:\s)*/g, '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse @import statements
|
||||
*
|
||||
* @param {String} str
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function (str) {
|
||||
var imports = getImports(str);
|
||||
|
||||
return imports.map(function (imp) {
|
||||
imp = imp.replace(/(?:;)$/g, '');
|
||||
|
||||
return {
|
||||
path: path(imp),
|
||||
condition: condition(imp),
|
||||
rule: imp
|
||||
};
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue