Use /assets for client assets

- Route `/assets` -> `build/public`, falling back on `public`
- Moved destinations for `nodebb.min.js`, `acp.min.js`, `admin.css`, `stylesheet.css`, `templates`, and `sounds` to `build/public`
- r.js modules previously routed through express are now symlinked into `public/build/src/modules`
- minfiles no longer served from a memory cache
- use config `views_dir` setting everywhere template directory is used
- fix cache buster `v=v=`
This commit is contained in:
Peter Jaszkowiak
2017-01-14 22:36:10 -07:00
parent e1a29f4aa8
commit 05b68391dd
27 changed files with 101 additions and 158 deletions

View File

@@ -86,15 +86,6 @@ module.exports = function (Meta) {
});
};
Meta.css.getFromFile = function (callback) {
async.series([
async.apply(Meta.css.loadFile, path.join(__dirname, '../../public/stylesheet.css'), 'cache'),
async.apply(Meta.css.loadFile, path.join(__dirname, '../../public/admin.css'), 'acpCache')
], function (err) {
callback(err);
});
};
function getStyleSource(files, prefix, extension, callback) {
var pluginDirectories = [],
source = '';
@@ -127,7 +118,7 @@ module.exports = function (Meta) {
Meta.css.commitToFile = function (filename, callback) {
var file = (filename === 'acpCache' ? 'admin' : 'stylesheet') + '.css';
fs.writeFile(path.join(__dirname, '../../public/' + file), Meta.css[filename], function (err) {
fs.writeFile(path.join(__dirname, '../../build/public/' + file), Meta.css[filename], function (err) {
if (!err) {
winston.verbose('[meta/css] ' + file + ' committed to disk.');
} else {
@@ -139,19 +130,6 @@ module.exports = function (Meta) {
});
};
Meta.css.loadFile = function (filePath, filename, callback) {
winston.verbose('[meta/css] Reading stylesheet ' + filePath.split('/').pop() + ' from file');
fs.readFile(filePath, function (err, file) {
if (err) {
return callback(err);
}
Meta.css[filename] = file;
callback();
});
};
function minify(source, paths, destination, callback) {
callback = callback || function () {};
less.render(source, {