GithubHelp home page GithubHelp logo

patrickberkeley / radiant-sns-minifier-extension Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aissac/radiant-sns-minifier-extension

2.0 1.0 0.0 272 KB

Allows you to minify your JS and/or CSS output. Keep all the comments and spacing in Radiant but serve up a condensed, light-weight version

License: Other

radiant-sns-minifier-extension's Introduction

= Styles 'n Scripts Minifier

Adds the ability to minify CSS and JS files.  This way, you can keep your code
the way you like it in the editor but serve up minified files.  (And if you
really want to speed things up, add GZip to the mix to have your server crunch
it further).


== Available Minifiers

  * JSMin v1.0.0 - This is based on the original C code by Douglas Crockford
    (http://www.crockford.com/javascript/jsmin.html) but wonderfully repackaged
    into a plugin by Ryan Grove (http://github.com/rgrove/cssmin/tree/master).
    
    JSMin is often seen as being an older but safer technology.  It certainly
    doesn't pack as well as some others out there but is tried and true.
    
  * CSSMin v1.0.0 - This is Ryan Grove's port of the YUI Compressor's
    (http://www.julienlecomte.net/yuicompressor/) CSS minifier (which was itself
    taken from Isaac Schlueter’s regular expression based CSS minifier
    (http://foohack.com/2007/09/squish-it-good-code-compression-for-the-masses/)
    
    Ryan nicely ported this one to a plugin too.  And I added a minor addition
    too (which is available via options -- see below)
    
  * Packr - James Coglan was nice enough to port Dean Edward's famous Packer
    (http://dean.edwards.name/packer/).  More about the plugin version used here
    can be found at: (http://blog.jcoglan.com/packr/)
    
    Packer is a great tool but it is pretty strict about terminating javascripts
    with semicolons (http://dean.edwards.name/packer/usage/sample.html).
    
  * Rainpress - This is a newer ruby project by Uwe L. Korn to minify CSS files
    (http://code.google.com/p/rainpress/).  There isn't much history but it
    seems solid enough.
    
    I had to repackage this one into a plugin (and strip a lot of the command
    line stuff out).  Originally I did all this as I didn't know about CSSMin.
    Anyway, I included this too basically because I'd already done everything.


== Usage
It's pretty simple, really.  Once installed, it adds a "Minify?" checkbox to the
bottom of your Stylesheet and Javascript pages.  Just check the box and save the
file.  Viola, the content is minified.

The configuration can be changed via the @@settings variable inside:
  /lib/text_asset_mixins.rb

There, you can choose which minifiers you want to use and set any of their
available options.


== Requirements
You'll need:
  * Radiant v0.7.1 or higher
  * Styles 'n Scripts Extension v0.5 or higher


== Installation
Install the extension in your Radiant project like:
  [your project]/vendor/extensions/sns_minifier

You will need the Styles 'n Scripts extension installed for this to work and you
will also probably need to change your project's environment.rb file to twiddle
the load order (the SnS Extension must be loaded before this one).  For example,
you could use something like:
  config.extensions = [ :all, :sns_minifier ] 

  
== To Do
Well first of all this extension needs some specs.

But after that I'd *love* to find where someone ported the YUI Compressor (JS 
version) to ruby.  It appears to be much more flexible (read forgiving) than
Packer while still crunching stuff way down.  A second option would be to let
admins install the java version and make this plugin interact with that.

radiant-sns-minifier-extension's People

Contributors

chrisparrish avatar ihoka avatar patrickberkeley avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.