Portfolio/node_modules/import-regex/index.js
oitsjustjose 4e066bffc9 Init
2017-02-25 03:50:31 -05:00

17 lines
406 B
JavaScript

'use strict';
/**
* Regular expression for matching CSS @imports
*
* @param {Object} opts
* @api public
*/
module.exports = function (opts) {
opts = opts || {};
var regex = '(?:@import)(?:\\s)(?:url)?(?:(?:(?:\\()(["\'])?(?:[^"\')]+)\\1(?:\\))|(["\'])(?:.+)\\2)(?:[A-Z\\s])*)+(?:;)';
return opts.exact ? new RegExp('(?:^' + regex + '$)', 'i') :
new RegExp('(?:^|\\s)?' + regex, 'gi');
};