From 058328b2c5672f59d4836f159340b87dd387cd11 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Fri, 21 Aug 2015 12:16:21 -0400 Subject: [PATCH 1/3] Use `ghost.min.css` when building for production. --- ghost/admin/Brocfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghost/admin/Brocfile.js b/ghost/admin/Brocfile.js index 08cd8408c5..d17571ac68 100644 --- a/ghost/admin/Brocfile.js +++ b/ghost/admin/Brocfile.js @@ -27,7 +27,7 @@ app = new EmberApp({ source: './app/styles/app.css', inputFile: 'app.css', browsers: 'last 2 versions', - outputFile: 'ghost.css' + outputFile: isProduction ? 'ghost.min.css' : 'ghost.css' }, hinting: false, fingerprint: disabled From 4955dc104ef5ae12a7e36767e8a1ccd7c1f7d3be Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Fri, 21 Aug 2015 12:17:39 -0400 Subject: [PATCH 2/3] Merge core/built instead of clearing on every build. --- ghost/admin/lib/asset-delivery/index.js | 17 +++++++++++------ ghost/admin/package.json | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ghost/admin/lib/asset-delivery/index.js b/ghost/admin/lib/asset-delivery/index.js index d24f55a346..735519c039 100644 --- a/ghost/admin/lib/asset-delivery/index.js +++ b/ghost/admin/lib/asset-delivery/index.js @@ -2,15 +2,20 @@ module.exports = { name: 'asset-delivery', postBuild: function (results) { var fs = this.project.require('fs-extra'), - cpd = this.project.require('ember-cli-copy-dereference'), + walkSync = this.project.require('walk-sync'), + assetsIn = results.directory + '/assets', templateOut = '../server/views/default.hbs', - assetsOut = '../built/assets'; + assetsOut = '../built/assets', + assets = walkSync(assetsIn); - fs.removeSync(templateOut); - fs.removeSync(assetsOut); fs.ensureDirSync(assetsOut); - cpd.sync(results.directory + '/index.html', templateOut); - cpd.sync(results.directory + '/assets', assetsOut); + fs.copySync(results.directory + '/index.html', templateOut, {clobber: true}); + + assets.forEach(function (relativePath) { + if (relativePath.slice(-1) === '/') { return; } + + fs.copySync(assetsIn + '/' + relativePath, assetsOut + '/' + relativePath, {clobber:true}); + }); } }; diff --git a/ghost/admin/package.json b/ghost/admin/package.json index 0961a49fc2..bb7250bc56 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -24,7 +24,6 @@ "ember-cli-app-version": "0.3.3", "ember-cli-babel": "^5.0.0", "ember-cli-content-security-policy": "0.4.0", - "ember-cli-copy-dereference": "1.0.0", "ember-cli-dependency-checker": "^1.0.0", "ember-cli-fastclick": "1.0.3", "ember-cli-htmlbars": "0.7.6", @@ -39,7 +38,8 @@ "ember-myth": "0.1.1", "ember-sinon": "0.2.1", "fs-extra": "0.16.3", - "glob": "^4.0.5" + "glob": "^4.0.5", + "walk-sync": "^0.1.3" }, "ember-addon": { "paths": [ From 873f19697d95e9ff2276368ae5e69126fbd8641a Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Fri, 21 Aug 2015 13:30:09 -0400 Subject: [PATCH 3/3] Move myth configuration into `Brocfile.js`. --- ghost/admin/Brocfile.js | 6 +++++- ghost/admin/config/environment.js | 14 -------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/ghost/admin/Brocfile.js b/ghost/admin/Brocfile.js index d17571ac68..d39665e6e9 100644 --- a/ghost/admin/Brocfile.js +++ b/ghost/admin/Brocfile.js @@ -1,7 +1,9 @@ /* global require, module */ var EmberApp = require('ember-cli/lib/broccoli/ember-app'), - isProduction = EmberApp.env() === 'production', + environment = EmberApp.env(), + isProduction = environment === 'production', + mythCompress = isProduction || environment === 'test', disabled = {enabled: false}, assetLocation, app; @@ -27,6 +29,8 @@ app = new EmberApp({ source: './app/styles/app.css', inputFile: 'app.css', browsers: 'last 2 versions', + sourcemap: !mythCompress, + compress: mythCompress, outputFile: isProduction ? 'ghost.min.css' : 'ghost.css' }, hinting: false, diff --git a/ghost/admin/config/environment.js b/ghost/admin/config/environment.js index b1d58578bd..55523d6b3e 100644 --- a/ghost/admin/config/environment.js +++ b/ghost/admin/config/environment.js @@ -41,9 +41,6 @@ module.exports = function (environment) { ENV.APP.LOG_TRANSITIONS = true; ENV.APP.LOG_TRANSITIONS_INTERNAL = true; ENV.APP.LOG_VIEW_LOOKUPS = true; - ENV.mythOptions = { - sourcemap: true - }; } if (environment === 'test') { @@ -56,17 +53,6 @@ module.exports = function (environment) { ENV.APP.LOG_VIEW_LOOKUPS = false; ENV.APP.rootElement = '#ember-testing'; - ENV.mythOptions = { - compress: true, - outputFile: 'ghost.min.css' - }; - } - - if (environment === 'production') { - ENV.mythOptions = { - compress: true, - outputFile: 'ghost.min.css' - }; } return ENV;