Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MinimizeCode.js #16

Open
jnbdz opened this issue Nov 9, 2015 · 0 comments
Open

MinimizeCode.js #16

jnbdz opened this issue Nov 9, 2015 · 0 comments
Labels

Comments

@jnbdz
Copy link
Member

jnbdz commented Nov 9, 2015

/*

---
description: Minimize CSS for faster download from the browser.

license: MIT-style

authors:
- Jean-Nicolas Boulay Desjardins (http://jean-nicolas.name/)
- Spot (http://linkedin.com/in/spotnyk)
- Tim Pietzcker (http://hs-ulm.de/ig)

requires:
 core/1.3:   '*'

provides:
- minimizeCode

...
*/

var minimizeCode = new Class({
css: function(css){
    return css.replace( /\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, '')
              .replace( / {2,}/g, ' ')
              .replace( / ([{:}]) /g, '$1')
              .replace( /([;,]) /g, '$1')
              .replace( / !/g, '!');
}
});
@jnbdz jnbdz added the Proposal label Nov 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant