Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* gulp dump-views --locales de,en
*
* If you want to export default templates you have to explicitly set the "default" language:
*
* gulp dump-views --locales default,de,en
*
* If you specify languages, your HTML views will be suffixed with the provided locale, e.g. index-en.html
*/
const argv = require('yargs').argv;
const config = require('config');
const view = require('@nitro/app/app/lib/view');
const del = require('del');
const getPort = require('get-port');
const serverPath = require('@nitro/app/app/lib/utils').getServerPath();
const tmpDirectory = `${config.get('nitro.tmpDirectory')}/views`;
const viewFilter = (viewItem) => {
if (config.has('gulp.dumpViews.viewFilter') && typeof config.get('gulp.dumpViews.viewFilter') === 'function') {
return config.get('gulp.dumpViews.viewFilter')(viewItem.url);
}
return true;
};
let isRunning = false;
let server;
function getViews() {
return view
.getViews(`${config.get('nitro.basePath')}${config.get('nitro.viewDirectory')}`)
.filter(viewFilter)
.map((viewItem) => viewItem.url);
'use strict';
const config = require('config');
const serverPath = require('@nitro/app/app/lib/utils').getServerPath();
module.exports = (gulp, plugins) => {
let taskCallbackCalled = false;
return (cb) => {
const server = plugins.liveServer(
serverPath,
{
env: {
PORT: Number(config.get('server.port')),
NODE_ENV: config.get('server.production') ? 'production' : 'development',
},
},
false
);
return server.start().then((result) => {