Ghost/ghost/admin/lib/asset-delivery/index.js
Kevin Ansfield c4d16d5d67 Bumped dependencies (#1108)
Bumped all non-ember-core dependencies that do not require significant work or that contain unresolvable inter-dependencies.

Skipped:
- `ember-drag-drop` - our usage needs re-working for closure actions
- `ember-infinity`, `ember-in-viewport` - one depends on the other and `ember-light-table` depends on a particular version of `ember-in-viewport` in a way that breaks if they are upgraded

Removed/bumped:
- removed ember-cli-es6-transform
- removed ember-cli-cjs-transform
- removed current-device
- removed ember-responsive
- bumped yarn.lock sub-dependencies
- bumped @ember/jquery
- bumped @tryghost/mobiledoc-kit
- bumped autoprefixer
- bumped broccoli-funnel
- bumped coveralls
- bumped ember-auto-import
- bumped ember-moment
- bumped ember-power-select
- bumped ember-simple-auth
- bumped broccoli-uglify-sourcemap
- bumped ember-cli-eslint and eslint-plugin-ghost with fixes for new rules
- bumped ember-cli-mirage
- bumped ember-cli-pretender
- bumped ember-power-calendar-moment
- bumped ember-power-datepicker
- bumped ember-composable-helpers
- bumped ember-concurrency
- bumped ember-load
- bumped eslint
- bumped walk-sync
- bumped ember-useragent
- bumped fs-extra
- bumped ember-resolver
- bumped @html-next/vertical-collection
- bumped ember-cli-babel
2019-03-05 17:34:00 +00:00

52 lines
1.7 KiB
JavaScript

/* eslint-disable */
'use strict';
module.exports = {
name: 'asset-delivery',
isDevelopingAddon() {
return true;
},
contentFor(type, config) {
let min = config.environment === 'production' ? '.min' : '';
if (type === 'minifiedInProductionCss') {
return `
<link rel="stylesheet" href="assets/vendor${min}.css">
<link rel="stylesheet" href="assets/ghost${min}.css" title="light">
`;
}
if (type === 'minifiedInProductionJs') {
return `
<script src="assets/vendor${min}.js"></script>
<script src="assets/ghost${min}.js"></script>
`;
}
},
postBuild: function (results) {
var fs = this.project.require('fs-extra'),
walkSync = this.project.require('walk-sync'),
assetsIn = results.directory + '/assets',
templateOutDir = '../server/web/admin/views',
assetsOut = '../built/assets',
assets = walkSync(assetsIn);
fs.ensureDirSync(assetsOut);
if (fs.existsSync(results.directory + '/index.min.html')) {
fs.copySync(results.directory + '/index.min.html', `${templateOutDir}/default-prod.html`, {overwrite: true, dereference: true});
} else {
fs.copySync(results.directory + '/index.html', `${templateOutDir}/default.html`, {overwrite: true, dereference: true});
}
assets.forEach(function (relativePath) {
if (relativePath.slice(-1) === '/') { return; }
fs.copySync(assetsIn + '/' + relativePath, assetsOut + '/' + relativePath, {overwrite: true, dereference: true});
});
}
};