Socket
Socket
Sign inDemoInstall

grunt-cssrazor

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

grunt-cssrazor

Produces cleaned CSS based on actually used DOM


Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

grunt-cssrazor

Removes unused CSS by actually analyzing the pages that consume the CSS using Phantom

Getting Started

Install this grunt plugin by running this command in root of your project,

npm install grunt-cssrazor

Then add this line to your project's Gruntfile.js.

grunt.loadNpmTasks('grunt-cssrazor');

Documentation

Configure task in Gruntfile.js,

cssrazor: {
  release: {
    options: {
      urls: [
        'http://www.changer.nl/',
        'http://www.changer.nl/team.html',
        'http://www.changer.nl/products.html',
        'http://www.changer.nl/contact.html',
        'http://www.changer.nl/portfolio.html',
        'http://www.changer.nl/legal/'
      ],
      input: 'app.css',
      output: 'release.css'
    }
  }
}

This instructs cssrazor to process source file app.css and store processed file into release.css.

Make sure you specify all unique url's that could possibly consume your CSS to make sure you don't remove used rules.

It's advisable to run grunt-contrib-cssmin after this task to make sure your CSS is optimized for production.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Initially released on 3 december 2013

License

Copyright (c) 2013 Ruben Stolk Licensed under the MIT license.

Keywords

FAQs

Package last updated on 03 Dec 2013

Did you know?

Socket

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.

Install

Related posts

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