Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: node_modules/vulcanize/lib/vulcan.js

Issue 877193002: Upgrade vulcanize to 0.7.6. (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « node_modules/vulcanize/lib/constants.js ('k') | node_modules/vulcanize/node_modules/cssom/.gitmodules » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: node_modules/vulcanize/lib/vulcan.js
diff --git a/node_modules/vulcanize/lib/vulcan.js b/node_modules/vulcanize/lib/vulcan.js
index 0d7e230add04c5c206444bfe6264e4081cdbedcf..82c3969256dd67a74beef5bb660dfeaff6610995 100644
--- a/node_modules/vulcanize/lib/vulcan.js
+++ b/node_modules/vulcanize/lib/vulcan.js
@@ -10,7 +10,6 @@
// jshint node: true
-var cssom = require('cssom');
var fs = require('fs');
var path = require('path');
var uglify = require('uglify-js');
@@ -200,19 +199,13 @@ function compressJS(content, inline) {
}
function compressCSS(content) {
- var out;
- try {
- var ast = cssom.parse(content);
- out = ast.toString();
- } catch (e) {
- if (options.verbose) {
- console.log('Error parsing CSS:', e.toString());
- console.log('Falling back to removing newlines only');
- }
- out = content;
- } finally {
- return out.replace(/[\r\n]/g, '');
- }
+ // remove newlines
+ var out = content.replace(/[\r\n]/g, '');
+ // remove css comments (/* ... */)
+ out = out.replace(/\/\*(.+?)\*\//g, '');
+ // remove duplicate whitespace
+ out = out.replace(/\s{2,}/g, ' ');
+ return out;
}
function removeCommentsAndWhitespace($) {
« no previous file with comments | « node_modules/vulcanize/lib/constants.js ('k') | node_modules/vulcanize/node_modules/cssom/.gitmodules » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698