forked from projects/fipamo
current theme assets are moved to public when rendering pages
This commit is contained in:
parent
4f1993516f
commit
cc1e709358
3 changed files with 39 additions and 2 deletions
|
@ -3,6 +3,7 @@ import StringUtils from '../../src/com/utils/StringUtils';
|
||||||
import Settings, { SETTINGS_FILE, SETTINGS_TAG } from './Settings';
|
import Settings, { SETTINGS_FILE, SETTINGS_TAG } from './Settings';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import sanitize from 'sanitize-html';
|
import sanitize from 'sanitize-html';
|
||||||
|
import Utils from './Utils';
|
||||||
const pug = require('pug');
|
const pug = require('pug');
|
||||||
const md = require('markdown-it')('commonmark');
|
const md = require('markdown-it')('commonmark');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
@ -137,6 +138,8 @@ export default class Render {
|
||||||
type: DataEvent.PAGES_RENDERED,
|
type: DataEvent.PAGES_RENDERED,
|
||||||
message: 'All Pages Rendered. Sweet.'
|
message: 'All Pages Rendered. Sweet.'
|
||||||
};
|
};
|
||||||
|
//utils.moveAssets();
|
||||||
|
new Utils().moveAssets();
|
||||||
resolve(response);
|
resolve(response);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import Settings from './Settings';
|
import Settings, { SETTINGS_FILE } from './Settings';
|
||||||
import Render from './Render';
|
import Render from './Render';
|
||||||
import StringUtils from '../../src/com/utils/StringUtils';
|
import StringUtils from '../../src/com/utils/StringUtils';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
@ -6,6 +6,7 @@ const settings = new Settings();
|
||||||
const render = new Render();
|
const render = new Render();
|
||||||
const stringUtils = new StringUtils();
|
const stringUtils = new StringUtils();
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
|
const fs = require('fs-extra');
|
||||||
|
|
||||||
export default class Utils {
|
export default class Utils {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
@ -93,4 +94,37 @@ export default class Utils {
|
||||||
}
|
}
|
||||||
render.publishArchive(archive);
|
render.publishArchive(archive);
|
||||||
}
|
}
|
||||||
|
moveAssets() {
|
||||||
|
settings
|
||||||
|
.load(SETTINGS_FILE)
|
||||||
|
.then(settings => {
|
||||||
|
//move css assets to public directory
|
||||||
|
fs.copy(
|
||||||
|
'content/themes/' + settings.global.theme + '/assets/css',
|
||||||
|
'public/assets/css',
|
||||||
|
function (err) {
|
||||||
|
if (err) {
|
||||||
|
//console.log('An error occured while copying the folder.', err);
|
||||||
|
//return console.error(err);
|
||||||
|
}
|
||||||
|
//console.log('Copy completed!');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//move js assets to public directory
|
||||||
|
fs.copy(
|
||||||
|
'content/themes/' + settings.global.theme + '/assets/scripts',
|
||||||
|
'public/assets/scripts',
|
||||||
|
function (err) {
|
||||||
|
if (err) {
|
||||||
|
//console.log('An error occured while copying the folder.', err);
|
||||||
|
//return console.error(err);
|
||||||
|
}
|
||||||
|
//console.log('Copy completed!');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
//console.log('ERROR', err);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
@import 'main/_typography'
|
@import 'main/_typography'
|
||||||
/**
|
/**
|
||||||
-------------------------------
|
-------------------------------
|
||||||
-- Main Structure
|
-- Main Structures
|
||||||
-------------------------------
|
-------------------------------
|
||||||
* */
|
* */
|
||||||
@import 'main/_structure'
|
@import 'main/_structure'
|
||||||
|
|
Loading…
Reference in a new issue