Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Mixr, is a compiler (Express compatible) and pre-processor for your Javascript and CSS.
Readme
Mixr, is a Node.JS compiler and pre-processor for your Javascript and CSS (compatible with Express.js).
Mixr will take the file you ask it to and output them in to a single file, compiling any Less or CoffeeScript files given..
Lets say that you've just created a new Express app using command like the following..
express music_library -t ejs
cd music_library && npm install
Add Mixr to your package.json file..
"mixr": ">= 0.0.1"
To create the default files and folders for Mixr, run the following..
./node_modules/mixr/bin/mixr init
If you dont want Express.js' old javascripts and stylesheet, remove them..
rm -R public/javascripts/ && rm -R public/stylesheets/
You would then open app.js and require Mixr..
var Mixr = require('mixr');
Add Mixr's helpers to the configuration
// Configuration
app.configure(function(){
Mixr.addHelpers(app);
});
To serve and compile assets on the fly in development mode, you need add the following line..
app.configure('development', function(){
// Add Mixr routes for development mode only
Mixr.addExpressRoutes(app);
});
In your layout add Mixr's routes..
<link rel="stylesheet" href="<%= css_path %>" type="text/css" charset="utf-8">
<script src="<%= js_path %>" type="text/javascript" charset="utf-8"></script>
Now, you should have four files.
./assets/css/app.css ./assets/css/main.css ./assets/css/app.js ./assets/css/main.js
If you look inside app.css you should see the following..
/*
*= require main.css
*/
This is because Mixr looks at app.css and app.js and uses them as a manifest of which files to get, note that any code in these files, will not be in the end result!
You can now require single files of different types and formats, as long as they exist, Mixr should know how to handle them!
/*
*= require main.css
*= require forms.css.less
*/
//= require lib/jquery.min.js
//= require main.js
//= require something.js.coffee
Although Mixr is very fast at generating the output files, it is just a waste of CPU etc to generate the assets on every request.
Therefor in production mode, it is recommended to generate the assets to a public folder and have either Nginx, Node, etc to server them normally..
To do this, run the following command on a deploy..
./node_modules/mixr/bin/mixr compile
This should output your app.css and app.js to ./public
Mixr provides a compiler for Less and CoffeeScript by default, though they do have to be included in the projects package.json
You can create your own compilers by specifying the extension and the function which to call to compile. For example..
Mixr.processors['sass'] = function(string, callback){
// Turn your string into sass here
var output = string.turnIntoSass;
// The first argument can be an error if there is one..
callback(null, output);
};
Mixr is designed to be quite modular, in the future, planned I might have the following.
FAQs
Mixr, is a compiler (Express compatible) and pre-processor for your Javascript and CSS.
The npm package mixr receives a total of 1 weekly downloads. As such, mixr popularity was classified as not popular.
We found that mixr 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.