Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
require.resolve('backbone/backbone.js'),
path.join(__dirname, '..', '..', 'dist', 'backbone.iosync.js'),
path.join(__dirname, '..', '..', 'dist', 'backbone.iobind.js')
]);
// serve using express
exports.vendorjs = folio.serve(vendorJs);
/**
* Template Javascript Package
*
* We are going to use pre-compiled
* jade on the client-side.
*/
var templateJs = new folio.Glossary([
require.resolve('jade/runtime.js'),
path.join(__dirname, '..', 'views/templates/js/header.js'),
path.join(__dirname, '..', 'views/templates/form.jade'),
path.join(__dirname, '..', 'views/templates/item.jade')
], {
compilers: {
jade: function (name, source) {
return 'template[\'' + name + '\'] = ' +
jade.compileClient(source, {
client: true,
compileDebug: false
}) + ';';
}
}
});
exports.index = function(req, res){
res.render('index', { title: 'Done.', layout: false });
};
/**
* Vendor Javascript Package
*
* jquery
* underscore
* backbone
* backbone.iosync
* backbone.iobind
*/
var vendorJs = new folio.Glossary([
//path.join(__dirname, '..', 'public', 'js', 'jquery.min.js'),
require.resolve('jquery/dist/jquery.js'),
require.resolve('underscore/underscore.js'),
require.resolve('backbone/backbone.js'),
path.join(__dirname, '..', '..', 'dist', 'backbone.iosync.js'),
path.join(__dirname, '..', '..', 'dist', 'backbone.iobind.js')
]);
// serve using express
exports.vendorjs = folio.serve(vendorJs);
/**
* Template Javascript Package
*
* We are going to use pre-compiled
* jade on the client-side.
});
};
// Go!
iteratePath(basepath);
/**
* Package together all found files into a
* folio.Glossary, defining a custom "compiler"
* that will wrap our script with the needed commonjs
*
* @param {Array} files
* @param {Object} folio glossary configuration
*/
var applicationJs = new folio.Glossary(appfiles, {
compilers: {
js: function (name, source, filename) {
var title = filename.replace(basepath + '/', '').replace('.js', '')
, buf = '\nrequire.register("' + title + '", function (module, exports, require) {\n';
buf += source;
buf += '\n}); // module ' + name;
return buf;
}
}
});
/*!
* Load up our prefix/suffix
*/
var prefix = fs.readFileSync(join(__dirname, 'browser', 'prefix.js'), 'utf8')
var drip = new folio.Glossary([
path.join(__dirname, '..', 'lib', 'drip.js')
], {
prefix: fs.readFileSync(path.join(__dirname, 'browser', 'prefix.js'), 'utf8'),
suffix: fs.readFileSync(path.join(__dirname, 'browser', 'suffix.js'), 'utf8')
});
drip.compile(function (err, source) {
var copyright = fs.readFileSync(path.join(__dirname, 'browser', 'copyright.js'));
fs.writeFileSync(path.join(__dirname, '..', 'drip.js'), copyright + '\n' + source);
console.log('Build successful: ' + '\tdrip.js');
});
var drip_min = new folio.Glossary([
path.join(__dirname, '..', 'lib', 'drip.js')
], {
minify: true,
prefix: fs.readFileSync(path.join(__dirname, 'browser', 'prefix.js'), 'utf8'),
suffix: fs.readFileSync(path.join(__dirname, 'browser', 'suffix.js'), 'utf8')
});
drip_min.compile(function (err, source) {
var copyright = fs.readFileSync(path.join(__dirname, 'browser', 'copyright.js'));
fs.writeFileSync(path.join(__dirname, '..', 'drip.min.js'), copyright + '\n' + source);
console.log('Build successful: ' + '\tdrip.min.js');
});
var folio = require('folio')
, path = require('path')
, fs = require('fs');
var drip = new folio.Glossary([
path.join(__dirname, '..', 'lib', 'drip.js')
], {
prefix: fs.readFileSync(path.join(__dirname, 'browser', 'prefix.js'), 'utf8'),
suffix: fs.readFileSync(path.join(__dirname, 'browser', 'suffix.js'), 'utf8')
});
drip.compile(function (err, source) {
var copyright = fs.readFileSync(path.join(__dirname, 'browser', 'copyright.js'));
fs.writeFileSync(path.join(__dirname, '..', 'drip.js'), copyright + '\n' + source);
console.log('Build successful: ' + '\tdrip.js');
});
var drip_min = new folio.Glossary([
path.join(__dirname, '..', 'lib', 'drip.js')
], {
minify: true,