From 931f3f6305803e168db82fa9a57c2889e63bbb17 Mon Sep 17 00:00:00 2001 From: Bill Dwyer Date: Thu, 10 Nov 2016 14:30:27 -0800 Subject: [PATCH] Optimize site build by removing sourcemaps (#67) * Optimize site build by removing sourcemaps * Just strip external sourcemaps from site ...instead of preventing them from being emitted in the first place. This allows our default package builds to still have source maps. --- gulp/sass.js | 3 ++- package.json | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gulp/sass.js b/gulp/sass.js index 0e44db99b52..79cb4e4ced8 100644 --- a/gulp/sass.js +++ b/gulp/sass.js @@ -53,6 +53,7 @@ module.exports = (gulp, plugins, blueprint) => { const postcssOptions = { to : blueprint.destPath(project, "dist.css"), + map: { inline: false }, }; const postcssPlugins = [ // inline all imports @@ -79,7 +80,7 @@ module.exports = (gulp, plugins, blueprint) => { .pipe(plugins.stripCssComments({ preserve: /^\*/ })) .pipe(plugins.replace(/\n{3,}/g, "\n\n")) // see https://github.com/floridoo/vinyl-sourcemaps-apply/issues/11#issuecomment-231220574 - .pipe(plugins.sourcemaps.write(undefined, { sourceRoot: null })) + .pipe(plugins.sourcemaps.write(".", { sourceRoot: null })) .pipe(blueprint.dest(project)) .pipe(plugins.connect.reload()); }); diff --git a/package.json b/package.json index 9553e3b0deb..913b7745457 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,11 @@ "bootstrap": "lerna bootstrap", "build:landing": "(cd packages/landing; npm run build)", "build:gulp": "NODE_ENV='\"production\"' gulp build", - "build:site": "npm-run-all build:gulp build:landing copy:docs copy:landing", - "copy:docs": "cp -r packages/docs/dist docs/docs", - "copy:landing": "cp -r packages/landing/dist/* docs/.", + "build:site": "npm-run-all build:gulp build:landing clean:docs copy:docs copy:landing delete:doc-source-maps", + "clean:docs": "rm -rf docs && git checkout docs/CNAME", + "copy:docs": "cp -rf packages/docs/dist docs/docs", + "copy:landing": "cp -rf packages/landing/dist/* docs/.", + "delete:doc-source-maps" : "find docs -name '*.map' -type f -delete", "serve": "http-server docs" }, "dependencies": {