Git Product home page Git Product logo

css-smasher's Introduction

CSS Masher

css-masher will analyse your css and remove unnecassary elements like comments and whitespace, without modify the meaning of your stylesheets.

Requirements

css-masher.js can be used in your application or on it's own. You need nodejs installed to run it from the command-line.

Installation

npm install css-smasher

If you've checked out the Git repo to do development install development dependencies with:

cd css-smasher
npm install --dev

Usage

Once installed with npm css-masher runs from the command-line:

css-smash input.css

The css is written to stdout, so you may want to pipe it into a file:

css-smash input.css > output.css

You can also use the --outfile parameter:

css-smash --outfile output.css input.css

For full usage do:

 css-smash --usage

Development

When developing, here are a few things you should know...

  1. The parser is built from the parser.jison file using "cake build:parser"
  2. To update your javascript as you're changing the coffeescript use "cake build:watch"

Running the tests

To run the tests you'll need to install the test dependencies (see Installation), then:

 cake spec

If your tests are failing you should consider running "cake build" to update all dependencies. You can use "cake build:watch" to rebuild while you work.

css-smasher's People

Contributors

markbennett avatar

Stargazers

Edwin Yip avatar node-migrator-bot avatar Li YuBei avatar  avatar Anton Byrna avatar Allen Bargi avatar

Watchers

James Cloos avatar

Forkers

sencaj

css-smasher's Issues

Ability to process stdin

It would be nice to be able to process CSS, coming from stdin, so I won't need to put css in temporary file after building with less, for example.

Output indents by 1 space after first line

I've concatenated multiple css files together through css-smash and I noticed that each line after line 1 starts with 1 space.

Example:

html, body {
 font-size:100%;
 }
 html, body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, p, a, abbr, acronym, address, cite, img, small, big, s, strike, sub, sup, pre, form, legend, fieldset, label, input, textarea, select, blockquote, q, table, caption, tbody, tfoot, thead, tr, th, td applet, object, iframe {
 margin:0;
 padding:0;
 border:0;
 outline:0;
 background:transparent;
 text-decoration:none;
 font-variant:normal;
 font-weight:normal;
 font-style:normal
 }
 /* ... */
body {
 background: #242424;
 font-family: Arial, Helvetica, sans-serif;
 }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.