Merge pull request #5382 from pitaj/assets-route

Move client-side assets to the `/assets` route
v1.18.x
Julian Lam 8 years ago committed by GitHub
commit 107abe3197

@ -18,3 +18,4 @@ logs/
*.ipr *.ipr
*.iws *.iws
/coverage /coverage
/build

@ -99,7 +99,7 @@ function loadConfig(callback) {
nconf.defaults({ nconf.defaults({
base_dir: __dirname, base_dir: __dirname,
themes_path: path.join(__dirname, 'node_modules'), themes_path: path.join(__dirname, 'node_modules'),
views_dir: path.join(__dirname, 'public/templates'), views_dir: path.join(__dirname, 'build/public/templates'),
version: pkg.version version: pkg.version
}); });

@ -231,12 +231,12 @@ function upgradePlugins(callback) {
if (['y', 'Y', 'yes', 'YES'].indexOf(result.upgrade) !== -1) { if (['y', 'Y', 'yes', 'YES'].indexOf(result.upgrade) !== -1) {
process.stdout.write('\nUpgrading packages...'); process.stdout.write('\nUpgrading packages...');
var args = ['npm', 'i']; var args = ['i'];
found.forEach(function (suggestObj) { found.forEach(function (suggestObj) {
args.push(suggestObj.name + '@' + suggestObj.suggested); args.push(suggestObj.name + '@' + suggestObj.suggested);
}); });
require('child_process').execFile('/usr/bin/env', args, { stdio: 'ignore' }, function (err) { cproc.execFile((process.platform === 'win32') ? 'npm.cmd' : 'npm', args, { stdio: 'ignore' }, function (err) {
if (!err) { if (!err) {
process.stdout.write(' OK\n'.green); process.stdout.write(' OK\n'.green);
} }

@ -12,7 +12,7 @@
"scripts": { "scripts": {
"start": "node loader.js", "start": "node loader.js",
"lint": "eslint --cache .", "lint": "eslint --cache .",
"pretest": "npm run lint && node app --build", "pretest": "npm run lint",
"test": "istanbul cover node_modules/mocha/bin/_mocha -- -R dot", "test": "istanbul cover node_modules/mocha/bin/_mocha -- -R dot",
"coveralls": "istanbul cover _mocha --report lcovonly -- -R dot && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage" "coveralls": "istanbul cover _mocha --report lcovonly -- -R dot && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
}, },

@ -333,7 +333,7 @@ $(document).ready(function () {
callback(templates.cache[template]); callback(templates.cache[template]);
} else { } else {
$.ajax({ $.ajax({
url: RELATIVE_PATH + '/templates/' + template + '.tpl' + (config['cache-buster'] ? '?v=' + config['cache-buster'] : ''), url: config.relative_path + '/assets/templates/' + template + '.tpl' + '?' + config['cache-buster'],
type: 'GET', type: 'GET',
success: function (data) { success: function (data) {
callback(data.toString()); callback(data.toString());

@ -558,7 +558,7 @@ app.cacheBuster = null;
var scriptEl = document.createElement('script'); var scriptEl = document.createElement('script');
scriptEl.type = 'text/javascript'; scriptEl.type = 'text/javascript';
scriptEl.src = config.relative_path + '/vendor/jquery/js/jquery-ui.js' + (app.cacheBuster ? '?v=' + app.cacheBuster : ''); scriptEl.src = config.relative_path + '/vendor/jquery/js/jquery-ui.js' + '?' + config['cache-buster'];
scriptEl.onload = callback; scriptEl.onload = callback;
document.head.appendChild(scriptEl); document.head.appendChild(scriptEl);
}; };
@ -625,7 +625,7 @@ app.cacheBuster = null;
app.loadProgressiveStylesheet = function () { app.loadProgressiveStylesheet = function () {
var linkEl = document.createElement('link'); var linkEl = document.createElement('link');
linkEl.rel = 'stylesheet'; linkEl.rel = 'stylesheet';
linkEl.href = config.relative_path + '/js-enabled.css'; linkEl.href = config.relative_path + '/assets/js-enabled.css';
document.head.appendChild(linkEl); document.head.appendChild(linkEl);
}; };

@ -84,7 +84,7 @@ define('forum/account/header', [
params: {uid: ajaxify.data.uid }, params: {uid: ajaxify.data.uid },
accept: '.png,.jpg,.bmp' accept: '.png,.jpg,.bmp'
}, function (imageUrlOnServer) { }, function (imageUrlOnServer) {
components.get('account/cover').css('background-image', 'url(' + imageUrlOnServer + '?v=' + Date.now() + ')'); components.get('account/cover').css('background-image', 'url(' + imageUrlOnServer + '?' + config['cache-buster'] + ')');
}); });
}, },
removeCover removeCover

@ -515,12 +515,12 @@
break; break;
} }
jQuery.getScript(config.relative_path + '/vendor/jquery/timeago/locales/jquery.timeago.' + languageCode + '.js').done(function () { jQuery.getScript(config.relative_path + '/assets/vendor/jquery/timeago/locales/jquery.timeago.' + languageCode + '.js').done(function () {
jQuery('.timeago').timeago(); jQuery('.timeago').timeago();
adaptor.timeagoShort = assign({}, jQuery.timeago.settings.strings); adaptor.timeagoShort = assign({}, jQuery.timeago.settings.strings);
// Retrieve the shorthand timeago values as well // Retrieve the shorthand timeago values as well
jQuery.getScript(config.relative_path + '/vendor/jquery/timeago/locales/jquery.timeago.' + languageCode + '-short.js').done(function () { jQuery.getScript(config.relative_path + '/assets/vendor/jquery/timeago/locales/jquery.timeago.' + languageCode + '-short.js').done(function () {
// Switch back to long-form // Switch back to long-form
adaptor.toggleTimeagoShorthand(); adaptor.toggleTimeagoShorthand();
}); });

@ -1,5 +1,5 @@
require.config({ require.config({
baseUrl: config.relative_path + "/src/modules", baseUrl: config.relative_path + '/assets/src/modules',
waitSeconds: 7, waitSeconds: 7,
urlArgs: config['cache-buster'], urlArgs: config['cache-buster'],
paths: { paths: {

@ -29,7 +29,7 @@
} }
}); });
$.get(config.relative_path + '/api/widgets/render' + (config['cache-buster'] ? '?v=' + config['cache-buster'] : ''), { $.get(config.relative_path + '/api/widgets/render' + '?' + config['cache-buster'], {
locations: widgetLocations, locations: widgetLocations,
template: template + '.tpl', template: template + '.tpl',
url: url, url: url,

@ -4,6 +4,7 @@ var fs = require('fs');
var path = require('path'); var path = require('path');
var async = require('async'); var async = require('async');
var sanitizeHTML = require('sanitize-html'); var sanitizeHTML = require('sanitize-html');
var nconf = require('nconf');
var utils = require('../../public/src/utils'); var utils = require('../../public/src/utils');
var Translator = require('../../public/src/modules/translator').Translator; var Translator = require('../../public/src/modules/translator').Translator;
@ -23,7 +24,7 @@ function filterDirectories(directories) {
} }
function getAdminNamespaces(callback) { function getAdminNamespaces(callback) {
utils.walk(path.resolve(__dirname, '../../public/templates/admin'), function (err, directories) { utils.walk(path.resolve(nconf.get('views_dir'), 'admin'), function (err, directories) {
if (err) { if (err) {
return callback(err); return callback(err);
} }
@ -60,7 +61,7 @@ var fallbackCacheInProgress = {};
var fallbackCache = {}; var fallbackCache = {};
function initFallback(namespace, callback) { function initFallback(namespace, callback) {
fs.readFile(path.resolve(__dirname, '../../public/templates/', namespace + '.tpl'), function (err, file) { fs.readFile(path.resolve(nconf.get('views_dir'), namespace + '.tpl'), function (err, file) {
if (err) { if (err) {
return callback(err); return callback(err);
} }

@ -2,6 +2,7 @@
var async = require('async'); var async = require('async');
var nconf = require('nconf');
var meta = require('../../meta'); var meta = require('../../meta');
var settingsController = module.exports; var settingsController = module.exports;
@ -25,7 +26,7 @@ function renderEmail(req, res, next) {
var path = require('path'); var path = require('path');
var utils = require('../../../public/src/utils'); var utils = require('../../../public/src/utils');
var emailsPath = path.join(__dirname, '../../../public/templates/emails'); var emailsPath = path.join(nconf.get('views_dir'), 'emails');
async.waterfall([ async.waterfall([
function (next) { function (next) {

@ -105,14 +105,10 @@ uploadsController.uploadSound = function (req, res, next) {
return next(err); return next(err);
} }
var soundsPath = path.join(__dirname, '../../../public/sounds'), var soundsPath = path.join(__dirname, '../../../build/public/sounds'),
filePath = path.join(__dirname, '../../../public/uploads/sounds', uploadedFile.name); filePath = path.join(__dirname, '../../../public/uploads/sounds', uploadedFile.name);
if (process.platform === 'win32') { file.link(filePath, path.join(soundsPath, path.basename(filePath)));
fs.link(filePath, path.join(soundsPath, path.basename(filePath)));
} else {
fs.symlink(filePath, path.join(soundsPath, path.basename(filePath)), 'file');
}
fs.unlink(uploadedFile.path, function (err) { fs.unlink(uploadedFile.path, function (err) {
if (err) { if (err) {

@ -26,7 +26,7 @@ function getCover(type, id) {
return covers[id]; return covers[id];
} }
return nconf.get('relative_path') + '/images/cover-default.png'; return nconf.get('relative_path') + '/assets/images/cover-default.png';
} }
module.exports = coverPhoto; module.exports = coverPhoto;

@ -102,4 +102,17 @@ file.existsSync = function (path) {
return !!exists; return !!exists;
}; };
file.link = function link(filePath, destPath, cb) {
if (process.platform === 'win32') {
fs.link(filePath, destPath, cb);
} else {
fs.symlink(filePath, destPath, 'file', cb);
}
};
file.linkDirs = function linkDirs(sourceDir, destDir, callback) {
var type = (process.platform === 'win32') ? 'junction' : 'dir';
fs.symlink(sourceDir, destDir, type, callback);
};
module.exports = file; module.exports = file;

@ -65,6 +65,9 @@ image.resizeImage = function (data, callback) {
} }
}, },
function (image, next) { function (image, next) {
if (data.write === false) {
return next();
}
image.write(data.target || data.path, next); image.write(data.target || data.path, next);
} }
], function (err) { ], function (err) {

@ -43,10 +43,15 @@ exports.build = function build(targets, callback) {
}; };
exports.buildTargets = function (targets, callback) { exports.buildTargets = function (targets, callback) {
var cacheBuster = require('./cacheBuster');
var meta = require('../meta'); var meta = require('../meta');
buildStart = buildStart || Date.now(); buildStart = buildStart || Date.now();
var step = function (startTime, target, next) { var step = function (startTime, target, next, err) {
if (err) {
winston.error('Build failed: ' + err.message);
process.exit(1);
}
winston.info('[build] ' + target + ' => Completed in ' + ((Date.now() - startTime) / 1000) + 's'); winston.info('[build] ' + target + ' => Completed in ' + ((Date.now() - startTime) / 1000) + 's');
next(); next();
}; };
@ -57,6 +62,8 @@ exports.buildTargets = function (targets, callback) {
winston.info('[build] Building javascript'); winston.info('[build] Building javascript');
var startTime = Date.now(); var startTime = Date.now();
async.series([ async.series([
meta.js.linkModules,
meta.js.linkStatics,
async.apply(meta.js.minify, 'nodebb.min.js'), async.apply(meta.js.minify, 'nodebb.min.js'),
async.apply(meta.js.minify, 'acp.min.js') async.apply(meta.js.minify, 'acp.min.js')
], step.bind(this, startTime, 'js', next)); ], step.bind(this, startTime, 'js', next));
@ -74,13 +81,13 @@ exports.buildTargets = function (targets, callback) {
case 'clientCSS': case 'clientCSS':
winston.info('[build] Building client-side CSS'); winston.info('[build] Building client-side CSS');
startTime = Date.now(); startTime = Date.now();
meta.css.minify('stylesheet.css', step.bind(this, startTime, target, next)); meta.css.minify('client', step.bind(this, startTime, target, next));
break; break;
case 'acpCSS': case 'acpCSS':
winston.info('[build] Building admin control panel CSS'); winston.info('[build] Building admin control panel CSS');
startTime = Date.now(); startTime = Date.now();
meta.css.minify('admin.css', step.bind(this, startTime, target, next)); meta.css.minify('admin', step.bind(this, startTime, target, next));
break; break;
case 'tpl': case 'tpl':
@ -108,14 +115,21 @@ exports.buildTargets = function (targets, callback) {
return process.exit(1); return process.exit(1);
} }
var time = (Date.now() - buildStart) / 1000; cacheBuster.write(function (err) {
if (err) {
winston.error('[build] Failed to write `cache-buster.conf`: ' + err.message);
return process.exit(1);
}
winston.info('[build] Asset compilation successful. Completed in ' + time + 's.'); var time = (Date.now() - buildStart) / 1000;
if (typeof callback === 'function') { winston.info('[build] Asset compilation successful. Completed in ' + time + 's.');
callback();
} else { if (typeof callback === 'function') {
process.exit(0); callback();
} } else {
process.exit(0);
}
});
}); });
}; };

@ -0,0 +1,46 @@
'use strict';
var fs = require('fs');
var path = require('path');
var mkdirp = require('mkdirp');
var winston = require('winston');
var filePath = path.join(__dirname, '../../build/cache-buster');
var cached;
// cache buster is an 11-character, lowercase, alphanumeric string
function generate() {
return (Math.random() * 1e18).toString(32).slice(0, 11);
}
exports.write = function write(callback) {
mkdirp(path.dirname(filePath), function (err) {
if (err) {
return callback(err);
}
fs.writeFile(filePath, generate(), callback);
});
};
exports.read = function read(callback) {
if (cached) {
return callback(null, cached);
}
fs.readFile(filePath, function (err, buffer) {
if (err) {
winston.warn('[cache-buster] could not read cache buster: ' + err.message);
return callback();
}
buffer = buffer.toString();
if (buffer) {
cached = buffer;
return callback(null, cached);
}
callback();
});
};

@ -6,7 +6,7 @@ var nconf = require('nconf');
var db = require('../database'); var db = require('../database');
var pubsub = require('../pubsub'); var pubsub = require('../pubsub');
var utils = require('../../public/src/utils'); var cacheBuster = require('./cacheBuster');
module.exports = function (Meta) { module.exports = function (Meta) {
@ -21,10 +21,16 @@ module.exports = function (Meta) {
Meta.configs.list(next); Meta.configs.list(next);
}, },
function (config, next) { function (config, next) {
config['cache-buster'] = 'v=' + utils.generateUUID(); cacheBuster.read(function (err, buster) {
if (err) {
return next(err);
}
config['cache-buster'] = 'v=' + (buster || Date.now());
Meta.config = config; Meta.config = config;
setImmediate(next); next();
});
} }
], callback); ], callback);
}; };

@ -18,8 +18,33 @@ var utils = require('../../public/src/utils');
module.exports = function (Meta) { module.exports = function (Meta) {
Meta.css = {}; Meta.css = {};
Meta.css.cache = undefined;
Meta.css.acpCache = undefined; var buildImports = {
client: function (source) {
return '@import "./theme";\n' + source + '\n' + [
'@import "font-awesome";',
'@import (inline) "../public/vendor/jquery/css/smoothness/jquery-ui.css";',
'@import (inline) "../public/vendor/jquery/bootstrap-tagsinput/bootstrap-tagsinput.css";',
'@import (inline) "../public/vendor/colorpicker/colorpicker.css";',
'@import (inline) "../node_modules/cropperjs/dist/cropper.css";',
'@import "../../public/less/flags.less";',
'@import "../../public/less/blacklist.less";',
'@import "../../public/less/generics.less";',
'@import "../../public/less/mixins.less";',
'@import "../../public/less/global.less";',
].map(function (str) { return str.replace(/\//g, path.sep); }).join('\n');
},
admin: function (source) {
return source + '\n' + [
'@import "font-awesome";',
'@import "../public/less/admin/admin";',
'@import "../public/less/generics.less";',
'@import (inline) "../public/vendor/colorpicker/colorpicker.css";',
'@import (inline) "../public/vendor/jquery/css/smoothness/jquery-ui.css";',
'@import (inline) "../public/vendor/jquery/bootstrap-tagsinput/bootstrap-tagsinput.css";',
].map(function (str) { return str.replace(/\//g, path.sep); }).join('\n');
},
};
Meta.css.minify = function (target, callback) { Meta.css.minify = function (target, callback) {
callback = callback || function () {}; callback = callback || function () {};
@ -30,25 +55,25 @@ module.exports = function (Meta) {
return callback(err); return callback(err);
} }
var themeId = (themeData['theme:id'] || 'nodebb-theme-persona'), var themeId = (themeData['theme:id'] || 'nodebb-theme-persona');
baseThemePath = path.join(nconf.get('themes_path'), (themeData['theme:type'] && themeData['theme:type'] === 'local' ? themeId : 'nodebb-theme-vanilla')), var baseThemePath = path.join(nconf.get('themes_path'), (themeData['theme:type'] && themeData['theme:type'] === 'local' ? themeId : 'nodebb-theme-vanilla'));
paths = [ var paths = [
baseThemePath, baseThemePath,
path.join(__dirname, '../../node_modules'), path.join(__dirname, '../../node_modules'),
path.join(__dirname, '../../public/vendor/fontawesome/less') path.join(__dirname, '../../public/vendor/fontawesome/less')
], ];
source = '@import "font-awesome";'; var source = '';
plugins.lessFiles = filterMissingFiles(plugins.lessFiles); var lessFiles = filterMissingFiles(plugins.lessFiles);
plugins.cssFiles = filterMissingFiles(plugins.cssFiles); var cssFiles = filterMissingFiles(plugins.cssFiles);
async.waterfall([ async.waterfall([
function (next) { function (next) {
getStyleSource(plugins.cssFiles, '\n@import (inline) ".', '.css', next); getStyleSource(cssFiles, '\n@import (inline) ".', '.css', next);
}, },
function (src, next) { function (src, next) {
source += src; source += src;
getStyleSource(plugins.lessFiles, '\n@import ".', '.less', next); getStyleSource(lessFiles, '\n@import ".', '.less', next);
}, },
function (src, next) { function (src, next) {
source += src; source += src;
@ -59,43 +84,11 @@ module.exports = function (Meta) {
return callback(err); return callback(err);
} }
var acpSource = source; minify(buildImports[target](source), paths, target, callback);
if (target !== 'admin.css') {
source += '\n@import (inline) "..' + path.sep + '..' + path.sep + 'public/vendor/jquery/css/smoothness/jquery-ui.css";';
source += '\n@import (inline) "..' + path.sep + '..' + path.sep + 'public/vendor/jquery/bootstrap-tagsinput/bootstrap-tagsinput.css";';
source += '\n@import (inline) "..' + path.sep + 'public/vendor/colorpicker/colorpicker.css";';
source += '\n@import "..' + path.sep + '..' + path.sep + 'public/less/flags.less";';
source += '\n@import "..' + path.sep + '..' + path.sep + 'public/less/blacklist.less";';
source += '\n@import "..' + path.sep + '..' + path.sep + 'public/less/generics.less";';
source += '\n@import "..' + path.sep + '..' + path.sep + 'public/less/mixins.less";';
source += '\n@import "..' + path.sep + '..' + path.sep + 'public/less/global.less";';
source += '\n@import (inline) "..' + path.sep + 'node_modules/cropperjs/dist/cropper.css";';
source = '@import "./theme";\n' + source;
minify(source, paths, 'cache', callback);
} else {
acpSource += '\n@import "..' + path.sep + 'public/less/admin/admin";\n';
acpSource += '\n@import "..' + path.sep + 'public/less/generics.less";\n';
acpSource += '\n@import (inline) "..' + path.sep + 'public/vendor/colorpicker/colorpicker.css";\n';
acpSource += '\n@import (inline) "..' + path.sep + 'public/vendor/jquery/css/smoothness/jquery-ui.css";';
acpSource += '\n@import (inline) "..' + path.sep + 'public/vendor/jquery/bootstrap-tagsinput/bootstrap-tagsinput.css";';
minify(acpSource, paths, 'acpCache', callback);
}
}); });
}); });
}; };
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) { function getStyleSource(files, prefix, extension, callback) {
var pluginDirectories = [], var pluginDirectories = [],
source = ''; source = '';
@ -125,35 +118,22 @@ module.exports = function (Meta) {
}); });
} }
Meta.css.commitToFile = function (filename, callback) { Meta.css.commitToFile = function (target, source, callback) {
var file = (filename === 'acpCache' ? 'admin' : 'stylesheet') + '.css'; var filename = (target === 'client' ? 'stylesheet' : 'admin') + '.css';
fs.writeFile(path.join(__dirname, '../../public/' + file), Meta.css[filename], function (err) { fs.writeFile(path.join(__dirname, '../../build/public/' + filename), source, function (err) {
if (!err) { if (!err) {
winston.verbose('[meta/css] ' + file + ' committed to disk.'); winston.verbose('[meta/css] ' + target + ' CSS committed to disk.');
} else { } else {
winston.error('[meta/css] ' + err.message); winston.error('[meta/css] ' + err.message);
process.exit(0); process.exit(1);
}
callback();
});
};
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(); callback();
}); });
}; };
function minify(source, paths, destination, callback) { function minify(source, paths, target, callback) {
callback = callback || function () {}; callback = callback || function () {};
less.render(source, { less.render(source, {
paths: paths paths: paths
@ -163,20 +143,14 @@ module.exports = function (Meta) {
return callback(err); return callback(err);
} }
postcss([ autoprefixer, clean() ]).process(lessOutput.css).then(function (result) { postcss(global.env === 'development' ? [ autoprefixer ] : [ autoprefixer, clean() ]).process(lessOutput.css).then(function (result) {
result.warnings().forEach(function (warn) { result.warnings().forEach(function (warn) {
winston.verbose(warn.toString()); winston.verbose(warn.toString());
}); });
Meta.css[destination] = result.css;
// Save the compiled CSS in public/ so things like nginx can serve it
if (nconf.get('local-assets') === undefined || nconf.get('local-assets') !== false) {
return Meta.css.commitToFile(destination, function () {
callback(null, result.css);
});
}
callback(null, result.css); return Meta.css.commitToFile(target, result.css, function () {
callback(null, result.css);
});
}); });
}); });
} }

@ -4,8 +4,11 @@ var winston = require('winston');
var fork = require('child_process').fork; var fork = require('child_process').fork;
var path = require('path'); var path = require('path');
var async = require('async'); var async = require('async');
var nconf = require('nconf');
var fs = require('fs'); var fs = require('fs');
var mkdirp = require('mkdirp');
var rimraf = require('rimraf');
var file = require('../file');
var plugins = require('../plugins'); var plugins = require('../plugins');
var utils = require('../../public/src/utils'); var utils = require('../../public/src/utils');
@ -86,30 +89,45 @@ module.exports = function (Meta) {
} }
} }
}; };
Meta.js.linkModules = function (callback) {
rimraf(path.join(__dirname, '../../build/public/src/modules'), function (err) {
if (err) {
return callback(err);
}
async.eachLimit(Object.keys(Meta.js.scripts.modules), 1000, function (relPath, next) {
var filePath = path.join(__dirname, '../../', Meta.js.scripts.modules[relPath]);
var destPath = path.join(__dirname, '../../build/public/src/modules', relPath);
Meta.js.bridgeModules = function (app, callback) { mkdirp(path.dirname(destPath), function (err) {
// Add routes for AMD-type modules to serve those files if (err) {
function addRoute(relPath) { return next(err);
var relativePath = nconf.get('relative_path'); }
app.get(relativePath + '/src/modules/' + relPath, function (req, res) { file.link(filePath, destPath, next);
return res.sendFile(path.join(__dirname, '../../', Meta.js.scripts.modules[relPath]), {
maxAge: app.enabled('cache') ? 5184000000 : 0
}); });
}); }, callback);
} });
};
var numBridged = 0;
for(var relPath in Meta.js.scripts.modules) { Meta.js.linkStatics = function (callback) {
if (Meta.js.scripts.modules.hasOwnProperty(relPath)) { rimraf(path.join(__dirname, '../../build/public/plugins'), function (err) {
addRoute(relPath); if (err) {
++numBridged; return callback(err);
} }
} async.eachLimit(Object.keys(plugins.staticDirs), 1000, function (mappedPath, next) {
var sourceDir = plugins.staticDirs[mappedPath];
var destDir = path.join(__dirname, '../../build/public/plugins', mappedPath);
mkdirp(path.dirname(destDir), function (err) {
if (err) {
return next(err);
}
winston.verbose('[meta/js] ' + numBridged + ' of ' + Object.keys(Meta.js.scripts.modules).length + ' modules bridged'); file.linkDirs(sourceDir, destDir, next);
callback(); });
}, callback);
});
}; };
Meta.js.minify = function (target, callback) { Meta.js.minify = function (target, callback) {
@ -139,12 +157,7 @@ module.exports = function (Meta) {
winston.verbose('[meta/js] ' + target + ' minification complete'); winston.verbose('[meta/js] ' + target + ' minification complete');
minifier.kill(); minifier.kill();
if (nconf.get('local-assets') === undefined || nconf.get('local-assets') !== false) { Meta.js.commitToFile(target, callback);
return Meta.js.commitToFile(target, callback);
} else {
return callback();
}
break; break;
case 'error': case 'error':
winston.error('[meta/js] Could not compile ' + target + ': ' + message.message); winston.error('[meta/js] Could not compile ' + target + ': ' + message.message);
@ -203,48 +216,11 @@ module.exports = function (Meta) {
}; };
Meta.js.commitToFile = function (target, callback) { Meta.js.commitToFile = function (target, callback) {
fs.writeFile(path.join(__dirname, '../../public/' + target), Meta.js.target[target].cache, function (err) { fs.writeFile(path.join(__dirname, '../../build/public/' + target), Meta.js.target[target].cache, function (err) {
callback(err); callback(err);
}); });
}; };
Meta.js.getFromFile = function (target, callback) {
function readFile(filePath, next) {
fs.readFile(filePath, function (err, contents) {
if (err) {
if (err.code === 'ENOENT') {
if (!filePath.endsWith('.map')) {
winston.warn('[meta/js] ' + filePath + ' not found on disk, did you run ./nodebb build?');
}
return next(null, '');
}
}
next(err, contents);
});
}
var scriptPath = path.join(nconf.get('base_dir'), 'public/' + target);
var mapPath = path.join(nconf.get('base_dir'), 'public/' + target + '.map');
async.parallel({
script: function (next) {
readFile(scriptPath, next);
},
map: function (next) {
readFile(mapPath, next);
}
}, function (err, results) {
if (err) {
return callback(err);
}
Meta.js.target[target] = {
cache: results.script,
map: results.map
};
callback();
});
};
function setupDebugging() { function setupDebugging() {
/** /**
* Check if the parent process is running with the debug option --debug (or --debug-brk) * Check if the parent process is running with the debug option --debug (or --debug-brk)

@ -8,6 +8,7 @@ var rimraf = require('rimraf');
var mkdirp = require('mkdirp'); var mkdirp = require('mkdirp');
var async = require('async'); var async = require('async');
var file = require('../file');
var plugins = require('../plugins'); var plugins = require('../plugins');
var db = require('../database'); var db = require('../database');
@ -28,7 +29,7 @@ module.exports = function (Meta) {
Meta.sounds.getFiles = function (callback) { Meta.sounds.getFiles = function (callback) {
async.waterfall([ async.waterfall([
function (next) { function (next) {
fs.readdir(path.join(__dirname, '../../public/sounds'), next); fs.readdir(path.join(__dirname, '../../build/public/sounds'), next);
}, },
function (sounds, next) { function (sounds, next) {
fs.readdir(path.join(__dirname, '../../public/uploads/sounds'), function (err, uploaded) { fs.readdir(path.join(__dirname, '../../public/uploads/sounds'), function (err, uploaded) {
@ -88,7 +89,7 @@ module.exports = function (Meta) {
}; };
function setupSounds(callback) { function setupSounds(callback) {
var soundsPath = path.join(__dirname, '../../public/sounds'); var soundsPath = path.join(__dirname, '../../build/public/sounds');
async.waterfall([ async.waterfall([
function (next) { function (next) {
@ -107,21 +108,6 @@ module.exports = function (Meta) {
return; return;
} }
if (nconf.get('local-assets') === false) {
// Don't regenerate the public/sounds/ directory. Instead, create a mapping for the router to use
Meta.sounds._filePathHash = filePaths.reduce(function (hash, filePath) {
hash[path.basename(filePath)] = filePath;
return hash;
}, {});
winston.verbose('[sounds] Sounds OK');
if (typeof next === 'function') {
return next();
} else {
return;
}
}
// Clear the sounds directory // Clear the sounds directory
async.series([ async.series([
function (next) { function (next) {
@ -138,11 +124,7 @@ module.exports = function (Meta) {
// Link paths // Link paths
async.each(filePaths, function (filePath, next) { async.each(filePaths, function (filePath, next) {
if (process.platform === 'win32') { file.link(filePath, path.join(soundsPath, path.basename(filePath)), next);
fs.link(filePath, path.join(soundsPath, path.basename(filePath)), next);
} else {
fs.symlink(filePath, path.join(soundsPath, path.basename(filePath)), 'file', next);
}
}, function (err) { }, function (err) {
if (!err) { if (!err) {
winston.verbose('[sounds] Sounds OK'); winston.verbose('[sounds] Sounds OK');

@ -48,7 +48,7 @@ module.exports = function (Meta) {
if (configObj.screenshot) { if (configObj.screenshot) {
configObj.screenshot_url = nconf.get('relative_path') + '/css/previews/' + configObj.id; configObj.screenshot_url = nconf.get('relative_path') + '/css/previews/' + configObj.id;
} else { } else {
configObj.screenshot_url = nconf.get('relative_path') + '/images/themes/default.png'; configObj.screenshot_url = nconf.get('relative_path') + '/assets/images/themes/default.png';
} }
next(null, configObj); next(null, configObj);
} catch (err) { } catch (err) {

@ -101,7 +101,7 @@ module.exports = function (middleware) {
plugins: results.custom_header.plugins, plugins: results.custom_header.plugins,
authentication: results.custom_header.authentication, authentication: results.custom_header.authentication,
scripts: results.scripts, scripts: results.scripts,
'cache-buster': meta.config['cache-buster'] ? 'v=' + meta.config['cache-buster'] : '', 'cache-buster': meta.config['cache-buster'] || '',
env: process.env.NODE_ENV ? true : false, env: process.env.NODE_ENV ? true : false,
title: (acpPath || 'Dashboard') + ' | NodeBB Admin Control Panel', title: (acpPath || 'Dashboard') + ' | NodeBB Admin Control Panel',
bodyClass: data.bodyClass bodyClass: data.bodyClass

@ -46,7 +46,7 @@ module.exports = function (middleware) {
bootswatchCSS: meta.config['theme:src'], bootswatchCSS: meta.config['theme:src'],
title: meta.config.title || '', title: meta.config.title || '',
description: meta.config.description || '', description: meta.config.description || '',
'cache-buster': meta.config['cache-buster'] ? 'v=' + meta.config['cache-buster'] : '', 'cache-buster': meta.config['cache-buster'] || '',
'brand:logo': meta.config['brand:logo'] || '', 'brand:logo': meta.config['brand:logo'] || '',
'brand:logo:url': meta.config['brand:logo:url'] || '', 'brand:logo:url': meta.config['brand:logo:url'] || '',
'brand:logo:alt': meta.config['brand:logo:alt'] || '', 'brand:logo:alt': meta.config['brand:logo:alt'] || '',

@ -102,7 +102,7 @@ module.exports = function (Plugins) {
} }
function runNpmCommand(command, pkgName, version, callback) { function runNpmCommand(command, pkgName, version, callback) {
require('child_process').execFile('npm', [command, pkgName + (command === 'install' ? '@' + version : '')], function (err, stdout) { require('child_process').execFile((process.platform === 'win32') ? 'npm.cmd' : 'npm', [command, pkgName + (command === 'install' ? '@' + version : '')], function (err, stdout) {
if (err) { if (err) {
return callback(err); return callback(err);
} }

@ -54,7 +54,9 @@ module.exports = function (Plugins) {
async.parallel([ async.parallel([
async.apply(mapFiles, pluginData, 'css', 'cssFiles'), async.apply(mapFiles, pluginData, 'css', 'cssFiles'),
async.apply(mapFiles, pluginData, 'less', 'lessFiles'), async.apply(mapFiles, pluginData, 'less', 'lessFiles'),
async.apply(mapClientSideScripts, pluginData) async.apply(mapClientSideScripts, pluginData),
async.apply(mapClientModules, pluginData),
async.apply(mapStaticDirectories, pluginData, pluginData.path),
], next); ], next);
}, next); }, next);
} }
@ -298,6 +300,7 @@ module.exports = function (Plugins) {
pluginData.version = packageData.version; pluginData.version = packageData.version;
pluginData.repository = packageData.repository; pluginData.repository = packageData.repository;
pluginData.nbbpm = packageData.nbbpm; pluginData.nbbpm = packageData.nbbpm;
pluginData.path = pluginPath;
} catch(err) { } catch(err) {
var pluginDir = pluginPath.split(path.sep); var pluginDir = pluginPath.split(path.sep);
pluginDir = pluginDir[pluginDir.length - 1]; pluginDir = pluginDir[pluginDir.length - 1];

@ -15,7 +15,6 @@ var metaRoutes = require('./meta');
var apiRoutes = require('./api'); var apiRoutes = require('./api');
var adminRoutes = require('./admin'); var adminRoutes = require('./admin');
var feedRoutes = require('./feeds'); var feedRoutes = require('./feeds');
var pluginRoutes = require('./plugins');
var authRoutes = require('./authentication'); var authRoutes = require('./authentication');
var helpers = require('./helpers'); var helpers = require('./helpers');
@ -121,7 +120,6 @@ module.exports = function (app, middleware, hotswapIds) {
metaRoutes(router, middleware, controllers); metaRoutes(router, middleware, controllers);
apiRoutes(router, middleware, controllers); apiRoutes(router, middleware, controllers);
feedRoutes(router, middleware, controllers); feedRoutes(router, middleware, controllers);
pluginRoutes(router, middleware, controllers);
mainRoutes(router, middleware, controllers); mainRoutes(router, middleware, controllers);
topicRoutes(router, middleware, controllers); topicRoutes(router, middleware, controllers);
@ -143,10 +141,44 @@ module.exports = function (app, middleware, hotswapIds) {
} }
app.use(middleware.privateUploads); app.use(middleware.privateUploads);
app.use(relativePath + '/assets', express.static(path.join(__dirname, '../../', 'build/public'), {
app.use(relativePath + '/assets', express.static(path.join(__dirname, '../../build/public'), {
maxAge: app.enabled('cache') ? 5184000000 : 0
}));
app.use(relativePath + '/assets', express.static(path.join(__dirname, '../../public'), {
maxAge: app.enabled('cache') ? 5184000000 : 0
}));
// TODO: deprecate?
app.use(relativePath + '/plugins', express.static(path.join(__dirname, '../../build/public/plugins'), {
maxAge: app.enabled('cache') ? 5184000000 : 0 maxAge: app.enabled('cache') ? 5184000000 : 0
})); }));
// DEPRECATED
var deprecatedPaths = [
'/nodebb.min.js',
'/acp.min.js',
'/stylesheet.css',
'/js-enabled.css',
'/admin.css',
'/logo.png',
'/favicon.ico',
'/vendor/',
'/uploads/',
'/templates/',
'/src/',
'/images/',
'/language/',
'/sounds/',
];
app.use(relativePath, function (req, res, next) {
if (deprecatedPaths.some(function (path) { return req.path.startsWith(path); })) {
winston.warn('[deprecated] Accessing `' + req.path.slice(1) + '` from `/` is deprecated. ' +
'Use `/assets' + req.path + '` to access this file.');
res.redirect(relativePath + '/assets' + req.path + '?' + meta.config['cache-buster']);
} else {
next();
}
});
// DEPRECATED // DEPRECATED
app.use(relativePath + '/api/language', function (req, res) { app.use(relativePath + '/api/language', function (req, res) {
winston.warn('[deprecated] Accessing language files from `/api/language` is deprecated. ' + winston.warn('[deprecated] Accessing language files from `/api/language` is deprecated. ' +
@ -154,10 +186,7 @@ module.exports = function (app, middleware, hotswapIds) {
res.redirect(relativePath + '/assets/language' + req.path + '.json?' + meta.config['cache-buster']); res.redirect(relativePath + '/assets/language' + req.path + '.json?' + meta.config['cache-buster']);
}); });
app.use(relativePath, express.static(path.join(__dirname, '../../', 'public'), { app.use(relativePath + '/assets/vendor/jquery/timeago/locales', middleware.processTimeagoLocales);
maxAge: app.enabled('cache') ? 5184000000 : 0
}));
app.use(relativePath + '/vendor/jquery/timeago/locales', middleware.processTimeagoLocales);
app.use(controllers.handle404); app.use(controllers.handle404);
app.use(controllers.handleURIErrors); app.use(controllers.handleURIErrors);
app.use(controllers.handleErrors); app.use(controllers.handleErrors);

@ -1,51 +1,6 @@
"use strict"; "use strict";
var path = require('path');
var nconf = require('nconf');
var meta = require('../meta');
function sendMinifiedJS(req, res) {
var target = path.basename(req.path);
var cache = meta.js.target[target] ? meta.js.target[target].cache : '';
res.type('text/javascript').send(cache);
}
// The portions of code involving the source map are commented out as they're broken in UglifyJS2
// Follow along here: https://github.com/mishoo/UglifyJS2/issues/700
// function sendJSSourceMap(req, res) {
// if (meta.js.hasOwnProperty('map')) {
// res.type('application/json').send(meta.js.map);
// } else {
// res.redirect(404);
// }
// };
function sendStylesheet(req, res) {
res.type('text/css').status(200).send(meta.css.cache);
}
function sendACPStylesheet(req, res) {
res.type('text/css').status(200).send(meta.css.acpCache);
}
function sendSoundFile(req, res, next) {
var resolved = meta.sounds._filePathHash[path.basename(req.path)];
if (resolved) {
res.status(200).sendFile(resolved);
} else {
next();
}
}
module.exports = function (app, middleware, controllers) { module.exports = function (app, middleware, controllers) {
app.get('/stylesheet.css', middleware.addExpiresHeaders, sendStylesheet);
app.get('/admin.css', middleware.addExpiresHeaders, sendACPStylesheet);
app.get('/nodebb.min.js', middleware.addExpiresHeaders, sendMinifiedJS);
app.get('/acp.min.js', middleware.addExpiresHeaders, sendMinifiedJS);
// app.get('/nodebb.min.js.map', middleware.addExpiresHeaders, sendJSSourceMap);
app.get('/sitemap.xml', controllers.sitemap.render); app.get('/sitemap.xml', controllers.sitemap.render);
app.get('/sitemap/pages.xml', controllers.sitemap.getPages); app.get('/sitemap/pages.xml', controllers.sitemap.getPages);
app.get('/sitemap/categories.xml', controllers.sitemap.getCategories); app.get('/sitemap/categories.xml', controllers.sitemap.getCategories);
@ -53,8 +8,4 @@ module.exports = function (app, middleware, controllers) {
app.get('/robots.txt', controllers.robots); app.get('/robots.txt', controllers.robots);
app.get('/manifest.json', controllers.manifest); app.get('/manifest.json', controllers.manifest);
app.get('/css/previews/:theme', controllers.admin.themes.get); app.get('/css/previews/:theme', controllers.admin.themes.get);
if (nconf.get('local-assets') === false) {
app.get('/sounds/*', middleware.addExpiresHeaders, sendSoundFile);
}
}; };

@ -1,40 +0,0 @@
"use strict";
var _ = require('underscore');
var path = require('path');
var plugins = require('../plugins');
module.exports = function (app, middleware, controllers) {
// Static Assets
app.get('/plugins/:id/*', middleware.addExpiresHeaders, function (req, res, next) {
var relPath = req._parsedUrl.pathname.replace('/plugins/', '');
var matches = _.map(plugins.staticDirs, function (realPath, mappedPath) {
if (relPath.match(mappedPath)) {
var pathToFile = path.join(plugins.staticDirs[mappedPath], decodeURIComponent(relPath.slice(mappedPath.length)));
if (pathToFile.startsWith(plugins.staticDirs[mappedPath])) {
return pathToFile;
}
}
return null;
}).filter(Boolean);
if (!matches || !matches.length) {
return next();
}
res.sendFile(matches[0], {}, function (err) {
if (err) {
if (err.code === 'ENOENT') {
// File doesn't exist, this isn't an error, to send to 404 handler
return next();
} else {
return next(err);
}
}
});
});
};

@ -57,7 +57,8 @@ module.exports = function (User) {
path: picture.path, path: picture.path,
extension: extension, extension: extension,
width: imageDimension, width: imageDimension,
height: imageDimension height: imageDimension,
write: false,
}, next); }, next);
}, },
function (next) { function (next) {

@ -4,8 +4,8 @@
<title>{title}</title> <title>{title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="{relative_path}/admin.css?{cache-buster}" /> <link rel="stylesheet" type="text/css" href="{relative_path}/assets/admin.css?{cache-buster}" />
<link rel="stylesheet" type="text/css" href="{relative_path}/vendor/mdl/mdl.min.css?{cache-buster}" /> <link rel="stylesheet" type="text/css" href="{relative_path}/assets/vendor/mdl/mdl.min.css?{cache-buster}" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script> <script>
@ -21,17 +21,17 @@
</script> </script>
<script src="https://storage.googleapis.com/code.getmdl.io/1.0.3/material.min.js"></script> <script src="https://storage.googleapis.com/code.getmdl.io/1.0.3/material.min.js"></script>
<script type="text/javascript" src="{relative_path}/vendor/jquery/sortable/Sortable.js?{cache-buster}"></script> <script type="text/javascript" src="{relative_path}/assets/vendor/jquery/sortable/Sortable.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/acp.min.js?{cache-buster}"></script> <script type="text/javascript" src="{relative_path}/assets/acp.min.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/colorpicker/colorpicker.js?{cache-buster}"></script> <script type="text/javascript" src="{relative_path}/assets/vendor/colorpicker/colorpicker.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/src/admin/admin.js?{cache-buster}"></script> <script type="text/javascript" src="{relative_path}/assets/src/admin/admin.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/ace/ace.js?{cache-buster}"></script> <script type="text/javascript" src="{relative_path}/assets/vendor/ace/ace.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/semver/semver.browser.js?{cache-buster}"></script> <script type="text/javascript" src="{relative_path}/assets/vendor/semver/semver.browser.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/jquery/serializeObject/jquery.ba-serializeobject.min.js?{cache-buster}"></script> <script type="text/javascript" src="{relative_path}/assets/vendor/jquery/serializeObject/jquery.ba-serializeobject.min.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/jquery/deserialize/jquery.deserialize.min.js?{cache-buster}"></script> <script type="text/javascript" src="{relative_path}/assets/vendor/jquery/deserialize/jquery.deserialize.min.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/snackbar/snackbar.min.js?{cache-buster}"></script> <script type="text/javascript" src="{relative_path}/assets/vendor/snackbar/snackbar.min.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/slideout/slideout.min.js?{cache-buster}"></script> <script type="text/javascript" src="{relative_path}/assets/vendor/slideout/slideout.min.js?{cache-buster}"></script>
<script type="text/javascript" src="{relative_path}/vendor/nprogress.min.js?{cache-buster}"></script> <script type="text/javascript" src="{relative_path}/assets/vendor/nprogress.min.js?{cache-buster}"></script>
<!-- BEGIN scripts --> <!-- BEGIN scripts -->
<script type="text/javascript" src="{scripts.src}"></script> <script type="text/javascript" src="{scripts.src}"></script>

@ -43,7 +43,7 @@
<p class="help-block"> <p class="help-block">
[[admin/settings/group:default-cover-help]] [[admin/settings/group:default-cover-help]]
</p> </p>
<input type="text" class="form-control input-lg" id="groups:defaultCovers" data-field="groups:defaultCovers" value="{config.relative_path}/images/cover-default.png" placeholder="https://example.com/group1.png, https://example.com/group2.png" /><br /> <input type="text" class="form-control input-lg" id="groups:defaultCovers" data-field="groups:defaultCovers" value="{config.relative_path}/assets/images/cover-default.png" placeholder="https://example.com/group1.png, https://example.com/group2.png" /><br />
</form> </form>
</div> </div>
</div> </div>

@ -131,7 +131,7 @@
<p class="help-block"> <p class="help-block">
[[admin/settings/uploads:default-covers-help]] [[admin/settings/uploads:default-covers-help]]
</p> </p>
<input type="text" class="form-control input-lg" id="profile:defaultCovers" data-field="profile:defaultCovers" value="{config.relative_path}/images/cover-default.png" placeholder="https://example.com/group1.png, https://example.com/group2.png" /> <input type="text" class="form-control input-lg" id="profile:defaultCovers" data-field="profile:defaultCovers" value="{config.relative_path}/assets/images/cover-default.png" placeholder="https://example.com/group1.png, https://example.com/group2.png" />
</form> </form>
</div> </div>
</div> </div>

@ -45,7 +45,7 @@ server.on('error', function (err) {
winston.error(err); winston.error(err);
if (err.code === 'EADDRINUSE') { if (err.code === 'EADDRINUSE') {
winston.error('NodeBB address in use, exiting...'); winston.error('NodeBB address in use, exiting...');
process.exit(0); process.exit(1);
} else { } else {
throw err; throw err;
} }
@ -88,7 +88,6 @@ function initializeNodeBB(callback) {
plugins.init(app, middleware, next); plugins.init(app, middleware, next);
}, },
async.apply(plugins.fireHook, 'static:assets.prepare', {}), async.apply(plugins.fireHook, 'static:assets.prepare', {}),
async.apply(meta.js.bridgeModules, app),
function (next) { function (next) {
plugins.fireHook('static:app.preload', { plugins.fireHook('static:app.preload', {
app: app, app: app,
@ -104,9 +103,6 @@ function initializeNodeBB(callback) {
}, },
function (next) { function (next) {
async.series([ async.series([
async.apply(meta.js.getFromFile, 'nodebb.min.js'),
async.apply(meta.js.getFromFile, 'acp.min.js'),
async.apply(meta.css.getFromFile),
async.apply(meta.sounds.init), async.apply(meta.sounds.init),
async.apply(languages.init), async.apply(languages.init),
async.apply(meta.blacklist.load) async.apply(meta.blacklist.load)

@ -3,6 +3,7 @@
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var async = require('async'); var async = require('async');
var nconf = require('nconf');
var plugins = require('../plugins'); var plugins = require('../plugins');
var admin = {}; var admin = {};
@ -25,7 +26,7 @@ admin.get = function (callback) {
plugins.fireHook('filter:widgets.getWidgets', [], next); plugins.fireHook('filter:widgets.getWidgets', [], next);
}, },
adminTemplate: function (next) { adminTemplate: function (next) {
fs.readFile(path.resolve(__dirname, '../../public/templates/admin/partials/widget-settings.tpl'), 'utf8', next); fs.readFile(path.resolve(nconf.get('views_dir'), 'admin/partials/widget-settings.tpl'), 'utf8', next);
} }
}, function (err, widgetData) { }, function (err, widgetData) {
if (err) { if (err) {

@ -20,7 +20,7 @@
base_dir: path.join(__dirname,'../..'), base_dir: path.join(__dirname,'../..'),
themes_path: path.join(__dirname, '../../node_modules'), themes_path: path.join(__dirname, '../../node_modules'),
upload_url: path.join(path.sep, '../../uploads', path.sep), upload_url: path.join(path.sep, '../../uploads', path.sep),
views_dir: path.join(__dirname, '../../public/templates'), views_dir: path.join(__dirname, '../../build/public/templates'),
relative_path: '' relative_path: ''
}); });

Loading…
Cancel
Save