source: imaps-frontend/node_modules/clean-css/lib/reader/extract-import-url-and-media.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 881 bytes
Line 
1var split = require('../utils/split');
2
3var BRACE_PREFIX = /^\(/;
4var BRACE_SUFFIX = /\)$/;
5var IMPORT_PREFIX_PATTERN = /^@import/i;
6var QUOTE_PREFIX_PATTERN = /['"]\s{0,31}/;
7var QUOTE_SUFFIX_PATTERN = /\s{0,31}['"]/;
8var URL_PREFIX_PATTERN = /^url\(\s{0,31}/i;
9var URL_SUFFIX_PATTERN = /\s{0,31}\)/i;
10
11function extractImportUrlAndMedia(atRuleValue) {
12 var uri;
13 var mediaQuery;
14 var normalized;
15 var parts;
16
17 normalized = atRuleValue
18 .replace(IMPORT_PREFIX_PATTERN, '')
19 .trim()
20 .replace(URL_PREFIX_PATTERN, '(')
21 .replace(URL_SUFFIX_PATTERN, ') ')
22 .replace(QUOTE_PREFIX_PATTERN, '')
23 .replace(QUOTE_SUFFIX_PATTERN, '');
24
25 parts = split(normalized, ' ');
26
27 uri = parts[0]
28 .replace(BRACE_PREFIX, '')
29 .replace(BRACE_SUFFIX, '');
30 mediaQuery = parts.slice(1).join(' ');
31
32 return [uri, mediaQuery];
33}
34
35module.exports = extractImportUrlAndMedia;
Note: See TracBrowser for help on using the repository browser.