
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
responsive-filenames
Advanced tools
📚📲 "Easy CSS Breakpoints"
This module allows you to easily delineate media query breakpoints by file name. For example, say we have five files:
all.css
print.css
0-600.css
600-1024.css
1024+.css
With responsive-filenames, you can write css in these files without worrying about cascading across media queries. The print stylesheet will be wrapped in @media print, and the various viewport stylesheets get wrapped in media queries based on their file name (hence responsive-filenames). A stylesheet called 0-600.css will look like:
@media screen and (min-width: 0px) and (max-width: 599.99px) {
/* styles */
}
You can specify any viewport size, and even have overlapping viewports. For example, you can have a combined mobile and tablet stylesheet, and some separate tablet fixes:
0-1024.css
600-1024.css
npm install --save responsive-filenames
If you want to use it in your terminal, you can also install it globally.
responsive-filenames input1.css [input2.css ...] [options]
You can pass multiple files or glob patterns into responsive-filenames. These are all valid:
responsive-filenames path/to/file1.css
responsive-filenames css/*.css
responsive-filenames css/*.css otherstyles/**
By default the compiled css will output to stdout. You can also pass -o filename (or --output filename) to write it to a file.
var rfn = require('responsive-filenames');
rfn('css/*.css', function (err, css) {
if (!err) {
// do something with the compiled css!
}
});
responsive-filenames is very flexible about the arguments you pass in. You can give it a glob or an array of globs, or even multiple file arguments. These are all valid:
var callback = function (err, css) {
if (!err) {
// do something with the compiled css!
}
};
rfn('path/to/file1.css', callback);
rfn(['path/to/file1.css', 'path/to/file2.css'], callback);
rfn('css/*.css', callback);
rfn('css/*.css', 'otherstyles/**', callback);
NOTE: The order of the files/globs you pass in is preserved, but globs themselves (usually) rely on filename order. Read more about globbing.
This module's async function follows node best practices, so you can easily promisify it with a library like bluebird
var Promise = require('bluebird'),
rfn = Promise.promisify(require('responsive-filenames'));
rfn('css/*.css')
.then(function (css) {
// do something with the compiled css!
})
.catch(function (e) {
// oh noes!
});
If you pass a stream into responsive-filenames, it'll compile each file individually and output them as another stream.
var rfn = require('responsive-filenames');
gulp.src('**/*.css')
.pipe(rfn())
.pipe(concat())
.pipe(cssmin())
.pipe(gulp.dest('compiled.css'));
FAQs
Easy CSS Breakpoints
We found that responsive-filenames 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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.