Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-single-charset

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-single-charset - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

package.json
{
"name": "postcss-single-charset",
"description": "Pop first @charset rule in CSS file.",
"version": "0.2.0",
"version": "0.2.1",
"author": "Kyo Nagashima <hail2u@gmail.com> (https://kyonagashima.com/)",

@@ -6,0 +6,0 @@ "bugs": {

'use strict';
module.exports = function (grunt) {
var taskName = 'single_charset';
var taskDescription = 'Pop first `@charset` rule in each CSS file.';
var pkg = require('../package.json');
pkg.name = pkg.name.replace(/^postcss-/, '').replace(/-/g, '_');
grunt.registerMultiTask(taskName, taskDescription, function () {
grunt.registerMultiTask(pkg.name, pkg.description, function () {
var fs = require('fs');

@@ -14,14 +14,33 @@ var postcss = require('postcss');

this.files.forEach(function (file) {
var fixed = postcss().use(
if (file.src.length !== 1) {
grunt.fail.warn('This Grunt plugin does not support multiple source files.');
}
var src = file.src[0];
var dest = file.dest;
if (!fs.existsSync(src)) {
grunt.log.warn('Source file "' + src + '" not found.');
return;
}
if (options.map) {
options.from = src;
options.to = dest;
}
var processed = postcss().use(
require('../index')()
).process(
fs.readFileSync(file.src[0], 'utf8'), options
fs.readFileSync(src, 'utf8'), options
);
fs.writeFileSync(file.dest, fixed.css);
grunt.log.writeln('File "' + file.dest + '" created.');
fs.writeFileSync(dest, processed.css);
grunt.log.writeln('File "' + dest + '" created.');
if (fixed.map) {
fs.writeFileSync(file.dest + '.map', fixed.map);
grunt.log.writeln('File "' + file.dest + '.map" created.');
if (processed.map) {
var map = dest + '.map';
fs.writeFileSync(map, processed.map);
grunt.log.writeln('File "' + map + '" created.');
}

@@ -28,0 +47,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc