
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
can-compile
Advanced tools
NodeJS module that compiles CanJS EJS and Mustache views into a single JavaScript file for lightning fast production apps.
With NodeJS installed, just run NPM:
npm install can-compile -g
The can-compile
command line tool takes a list of files (by default all *.ejs
and *.mustache
files in the current folder)
or a list of filename patterns and writes the compiled views into an out
file
(default: views.production.js
).
Examples:
Compile all EJS and Mustache files in the current folder and write them to views.combined.js
:
can-compile --out views.combined.js
Compile todo.ejs
, write it to views.production.js
:
can-compile todo.ejs
Compile all EJS files in the current directory and all subdirectories and mustache/test.mustache
.
Write the result to views.combined.js
:
can-compile **/*.ejs mustache/test.mustache --out views.combined.js
can-compile also comes with a Grunt task so you can easily make it part of your production build.
Just npm install can-compile
in you project folder (or add it as a development dependency).
The following example shows a Gruntfile that compiles all Mustache views and then builds a concatenated and minified production.js
of a CanJS application:
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
cancompile: {
dist: {
src: ['**/*.ejs', '**/*.mustache'],
out: 'production/views.production.js'
}
},
concat: {
dist: {
src: [
'../resources/js/can.jquery.js',
'../resources/js/can.view.mustache.js',
'js/app.js', // You app
'<%= cancompile.dist.out %>' // The compiled views
],
dest: 'production/production.js'
}
},
uglify: {
dist: {
files: {
'production/production.min.js': ['<%= concat.dist.dest %>']
}
}
}
});
// Default task.
grunt.registerTask('default', ['cancompile', 'concat', 'uglify']);
grunt.loadTasks('../tasks');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
};
You can compie files directly like this:
var compiler = require('can-compile');
compiler.compile('file.ejs', function(error, output) {
output // -> compiled `file.ejs`
});
Always make sure that the output file is in the same folder as the root level for the views that are being loaded.
So if your CanJS applications HTML file is in the app
folder within the current directory use a filename within
that folder as the output file:
can-compile --out app/views.production.js
0.2.1:
0.2.0:
0.1.0:
FAQs
Compile CanJS Mustache and EJS views for lightning fast production apps
The npm package can-compile receives a total of 41 weekly downloads. As such, can-compile popularity was classified as not popular.
We found that can-compile demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.