
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
browserify-less-transfrom
Advanced tools
browserify less transform allow us use import/require(xxxx.less|css)
Experimental
Browserify transform to require('file.less')
and output the compiled css into a file.
The rest of Css and Less Browserify transforms point to
head.appendChild('<style>' + your_css + '</style>');
This transform will generate a stream with your compiled css and an interface to piping transforms into it so you can do what every you like.
// index.js
require('./style.less')
/* style.less */
body {
background-color: blue;
}
will generate a separate bundle file compiled.css
/* compiled.css */
body {
background-color: blue;
}
:thumbsup:
require('file.css') and require('file.less') will work!css and less@importpipe method)This is my recommended way of outputing the compiled css into a file, but you can also use
fs.createWriteStream('path/compiled.css') and of course any other analogues.
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var require_less = require('require-less')({
pipe: [
source('bundle.css'),
gulp.dest('./test')
]
});
In the preceding example the vinyl-source-stream library is being used to turn
the regular stream to something gulp can handle.
This illustrates that you can use the pipe attribute to pipe any stream transform providing complete freedom for what you want to do.
test/test_case_3.js is a test using a 2 gulp plugins: gulp-rev and gulp-buffer.
require('require_less')(options)It will return a transform function ready to be used by browserify.
var require_less = require('require_less')(options)
browserify(browserify_opts).transform(require_less);
browserify_optsits just regular browserify opts
optionsOptions will host all the regular less parser options plus some useful attributes as detailed below.
options.pipeThis attribute provides an interface to deal with the css stream as you will regularly
do with read_stream.pipe(transform_stream);.
The pipe array will be executed in order in the following way:
css_stream.pipe(pipe[0])
.pipe(pipe[1])
.pipe(pipe[2])
...
.pipe(pipe[n]);
options.cbProvide a callback that will be executed at the end of the stream transform process.
Checkout travis.ci badge, or run locally the tests by
cd path/to/repo/root
npm test
browserify.transform in package.json due to its nature.The following are links to sources of inspiration and conflict solving when I was working on this Transform. I have copied pieces of code from them so they are contributors.
FAQs
browserify less transform allow us use import/require(xxxx.less|css)
The npm package browserify-less-transfrom receives a total of 7 weekly downloads. As such, browserify-less-transfrom popularity was classified as not popular.
We found that browserify-less-transfrom 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
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.