Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Simple static-file build system for jade, stylus, and JavaScript.
mason
executable for easily building projects.You have a dozen site-wide platform dependencies that you want to package in platform.js
.
You have per-page JS assets that you want to package in page-name.js
files.
During development, you need all of these assets to be included as separate, uncompiled files with line numbers.
During production, you need to flip a switch to minify all these files and include them in the right places.
You want to easily generate static html and css from jade and stylus.
$ npm install -g mason
or use package.json's devDependencies:
"dependencies":{
"mason":"latest"
}
use the settings in mason.json:
$ mason build
or using devDependencies:
$ node_modules/.bin/mason build
$ mason watch
(mason is smart about recompiling - it performs the minimum possible build for each file change)
$ mason watch -j debug
!!! 5
html
head
!= mason('platform.js')
By default, mason build
injects compressed (uglified) script tags via the != mason()
local.
To inject individual scripts for debugging, use:
$ mason build -j debug
base: Tells mason.build() where to put your compiled files
src: Used by mason.locals() to render URLs (eg, /compiled/platform.js instead of /work/project/public/compiled/platform.js)
renderer: Specify the default renderer for this asset
javascript:" Specify the default renderer for this type of asset
{
"views": {
"type": "jade",
"sourceRoot": "views",
"sourcePaths": ["test.jade"],
"destRoot": "public",
"destPath": "test.html"
},
"platform.js": {
"type": "javascript",
"sourceRoot": "public",
"sourcePaths": [
"vendor/underscore-1.3.3.js",
"vendor/knockout-2.0.0.js"
],
"destRoot": "public",
"destPath": "compiled/platform.js"
},
"page.js": {
"type": "javascript",
"sourceRoot": "public",
"sourcePaths": [
"js/a.js",
"js/b.js"
],
"destRoot": "public",
"destPath": "compiled/page.js"
},
"global.css": {
"type": "stylus",
"sourceRoot": "styles",
"sourcePaths": [ "global.styl" ],
"destRoot": "public",
"destPath": "compiled/global.css"
}
}
var mason = require('mason');
mason.build(__dirname, {
'page.js': 'uglify'
});
(mason.json resides in __dirname)
var app = express();
app.locals(mason.locals(__dirname));
By default, mason.locals will inject a compressed (uglified) script into your view.
To control how specific assets are injected, use:
var app = express(),
config = {
'platform.js': 'uglify',
'page.js': 'debug'
};
app.locals(mason.locals(__dirname, config));
FAQs
simple, fun, static-file builder for jade, stylus, and javascript
The npm package mason receives a total of 42 weekly downloads. As such, mason popularity was classified as not popular.
We found that mason demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.