Sorry, the diff of this file is not supported yet
| /*===================================================== | ||
| contents of: import1.css | ||
| =====================================================*/ | ||
| .rule1 { } | ||
| /*===================================================== | ||
| contents of: main.css | ||
| =====================================================*/ | ||
| .rule2 { } | ||
| .rule1 { } |
| @import url('import1.css'); | ||
| .rule2 { } |
| /*===================================================== | ||
| contents of: import1.css | ||
| =====================================================*/ | ||
| .rule1 { } | ||
| /*===================================================== | ||
| contents of: main.css | ||
| =====================================================*/ | ||
| .rule2 { } | ||
| /*===================================================== | ||
| contents of: import2.css | ||
| =====================================================*/ | ||
| .rule1 { } | ||
| /*===================================================== | ||
| contents of: import1.css | ||
| =====================================================*/ | ||
| .rule2 { } | ||
| /*===================================================== | ||
| contents of: main.css | ||
| =====================================================*/ | ||
| .rule3 { } | ||
| @import url('import2.css'); | ||
| .rule2 { } |
| .rule1 { } |
| @import url('import1.css'); | ||
| .rule3 { } |
| /*===================================================== | ||
| contents of: import2.css | ||
| =====================================================*/ | ||
| .rule1 { } | ||
| /*===================================================== | ||
| contents of: import1.css | ||
| =====================================================*/ | ||
| .rule2 { } | ||
| /*===================================================== | ||
| contents of: main.css | ||
| =====================================================*/ | ||
| .rule3 { } | ||
| /*===================================================== | ||
| contents of: subfolder/import1.css | ||
| =====================================================*/ | ||
| .rule1 .url-pattern-test { | ||
| background: url(images/source.png); | ||
| } | ||
| .rule2 .url-pattern-test { | ||
| background: url('subfolder/insubfolder/source.png'); | ||
| } | ||
| /*===================================================== | ||
| contents of: main.css | ||
| =====================================================*/ | ||
| .rule3 .url-pattern-test { | ||
| background: url("images/source.png"); | ||
| } | ||
| @import url('subfolder/import1.css'); | ||
| .rule3 .url-pattern-test { | ||
| background: url("images/source.png"); | ||
| } |
| .rule1 .url-pattern-test { | ||
| background: url(../images/source.png); | ||
| } | ||
| .rule2 .url-pattern-test { | ||
| background: url('insubfolder/source.png'); | ||
| } |
| /*===================================================== | ||
| contents of: subfolder/import1.css | ||
| =====================================================*/ | ||
| .rule1 .url-pattern-test { | ||
| background: url(images/source.png); | ||
| } | ||
| .rule2 .url-pattern-test { | ||
| background: url('subfolder/insubfolder/source.png'); | ||
| } | ||
| /*===================================================== | ||
| contents of: main.css | ||
| =====================================================*/ | ||
| .rule3 .url-pattern-test { | ||
| background: url("images/source.png"); | ||
| } | ||
+41
-25
@@ -1,48 +0,64 @@ | ||
| exports.concat = function(filename) { | ||
| exports.concat = function(input, output) { | ||
| output = output || input.replace('.css','-out.css'); | ||
| var fs = require('fs'), | ||
| path = require('path'), | ||
| output = fs.createWriteStream(filename.replace('.css','-out.css')), | ||
| outfile = fs.createWriteStream(output), | ||
| urlRegex = /(?:url\([\'\"]*)(.*?)(?:[\'\"]*\))/, | ||
| rootPath = path.dirname(path.resolve(filename)), | ||
| rootPath = path.dirname(path.resolve(input)), | ||
| seperator = '=====================================================', | ||
| lastImport = function(lineArray) { | ||
| var index = 0, | ||
| innerIndex = 0; | ||
| lineArray.forEach(function(line) { | ||
| innerIndex++; | ||
| if (line.indexOf('@import') === 0) index = innerIndex; | ||
| }); | ||
| return index; | ||
| }, | ||
| concatenate = function(filename) { | ||
| var currentPath = path.dirname(path.resolve(filename)); | ||
| var currentPath = path.dirname(path.resolve(filename)), | ||
| file = fs.readFileSync(filename), | ||
| index = 0, | ||
| importIndex = 0; | ||
| output.write('/* Contents of: ' + filename + ' */\n'); | ||
| file = ('' + file).split('\n'); | ||
| importIndex = lastImport(file); | ||
| fs.readFile(filename, function(err, data) { | ||
| file.forEach(function(line) { | ||
| // append the incoming data to the remaining data. | ||
| var content = "" + data; | ||
| content = content.split('\n'); | ||
| if (importIndex === index) { | ||
| content.forEach(function(line) { | ||
| outfile.write('/*' + seperator + '\n'); | ||
| outfile.write(' contents of: ' + path.relative(rootPath, filename) + '\n'); | ||
| outfile.write(' ' + seperator + '*/\n'); | ||
| } | ||
| var urlMatch = line.match(urlRegex); | ||
| var urlMatch = line.match(urlRegex); | ||
| if (line.indexOf('@import') === 0) { | ||
| if (line.indexOf('@import') === 0) { | ||
| var nextFile = urlMatch[1]; | ||
| concatenate(nextFile); | ||
| var nextFile = urlMatch[1]; | ||
| concatenate(rootPath + '/' + nextFile); | ||
| } else if (urlMatch) { | ||
| } else if (urlMatch) { | ||
| var relImgPath = urlMatch[1], | ||
| rootRelImgPath = path.relative(rootPath, currentPath + '/' + relImgPath); | ||
| output.write(line.replace(relImgPath, rootRelImgPath) + '\n'); | ||
| var imgPath = urlMatch[1], | ||
| relImgPath = path.relative(rootPath, currentPath + '/' + imgPath); | ||
| outfile.write(line.replace(imgPath, relImgPath) + '\n'); | ||
| } else { | ||
| } else { | ||
| output.write(line + '\n'); | ||
| outfile.write(line + '\n'); | ||
| } | ||
| } | ||
| index++; | ||
| }); | ||
| }); | ||
| }); | ||
| }; | ||
| concatenate(filename); | ||
| concatenate(input); | ||
| }; |
+3
-2
@@ -5,5 +5,6 @@ { | ||
| "description": "Concatenate @imported CSS files.", | ||
| "version": "0.0.0", | ||
| "version": "0.0.1", | ||
| "repository": { | ||
| "url": "" | ||
| "type" : "git", | ||
| "url": "git://github.com/ilovecode/CSS-Concat.git" | ||
| }, | ||
@@ -10,0 +11,0 @@ "main": "./bin/cssc", |
| /* Test-CSS */ | ||
| @import url('deeper/test2.css'); | ||
| Line 16 | ||
| Line 17 | ||
| Line 18 | ||
| Line 19 | ||
| Line 20 | ||
| Line 21 | ||
| Line 22 | ||
| Line 23 | ||
| Line 24 | ||
| Line 25 | ||
| Line 26 | ||
| Line 27 | ||
| Line 28 | ||
| Line 29 | ||
| Line 30 |
| /* Test2-CSS */ | ||
| .test { | ||
| background: url(gfx/image.gif); | ||
| } | ||
| Line 01 | ||
| Line 02 | ||
| Line 03 | ||
| Line 04 | ||
| Line 05 | ||
| Line 06 | ||
| Line 07 | ||
| Line 08 | ||
| Line 09 | ||
| Line 10 | ||
| Line 11 | ||
| Line 12 | ||
| Line 13 | ||
| Line 14 | ||
| Line 15 |
Sorry, the diff of this file is not supported yet
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
5173
161.79%17
240%134
103.03%1
-50%