How to use @nitro/app - 4 common examples

To help you get started, we’ve selected a few @nitro/app examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github namics / generator-nitro / packages / nitro-gulp / tasks / dump-views.js View on Github external
function getViews() {
	return view
		.getViews(`${config.get('nitro.basePath')}${config.get('nitro.viewDirectory')}`)
		.filter(viewFilter)
		.map((viewItem) => viewItem.url);
}
github namics / generator-nitro / packages / nitro-gulp / tasks / dump-views.js View on Github external
*  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);
github namics / generator-nitro / packages / nitro-gulp / tasks / serve.js View on Github external
'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) => {
github namics / generator-nitro / packages / nitro-gulp / tasks / lint-html.js View on Github external
return () => {
		return gulp.src(srcPattern)
			.pipe(plugins.htmllint({}, lint.htmllintReporter))
			.on('end', () => {});
	};
};

@nitro/app

Nitro server

MIT
Latest version published 1 day ago

Package Health Score

71 / 100
Full package analysis