
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
postcss-split-mq
Advanced tools
PostCSS plugin to split specific media queries into separate files.
Assuming a CSS file like this:
/* main.css */
body {
color: tangerine;
}
@media (min-width: 1024px) {
body {
color: pink;
}
}
You can split it like this:
const postcss = require('postcss');
const splitMq = require('postcss-split-mq');
const CSS = readFile('main.css');
const options = {
outpath: './',
files: [
{
name: 'wide.css',
match: /min-width:\s*1024px/
}
]
};
postcss([splitMq(options)])
.process(CSS)
.then(result => {
// result will be a postcss container with the remaining CSS
// after striping all media queries that match the `files` option
writeFile('remaining.css', result.css)
});
And that will give you:
/* remaining.css */
body {
color: tangerine;
}
and:
/* wide.css */
@media (min-width: 1024px) {
body {
color: pink;
}
}
You can create multiple files
with multiple match
criteria per file. Media queries are captured for a given file if any of its match expressions are found.
e.g.
options = {
outpath: './',
files: [
{
name: 'medium.css',
match: [
/min-width:\s*(640px|40r?em)/,
/max-width:\s*(800px|50r?em)/
]
},
{
name: 'wide.css',
match: /min-width:\s*1024px/
}
]
};
This can be improved. Contributions are welcome. Create an issue if you see a problem or to ask a question.
1.3.0
files.skip
to override matched media queriesoutpath
will resolve to process.cwd()
if not otherwise specifiedFAQs
Postcss plugin to split media queries into separate files
The npm package postcss-split-mq receives a total of 29 weekly downloads. As such, postcss-split-mq popularity was classified as not popular.
We found that postcss-split-mq 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
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.