![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Crush is a set of Tilt templates for the various JavaScript and CSS compression libraries in Ruby.
See here for more information about Tilt templates: http://github.com/rtomayko/tilt
Well, they're not really templates. They're more like engines or processors. But, anyway, they fit in very well with Tilt, because each one likes to do things a little differently. Tilt + Crush cures the headache by providing a generic API to use any of the engines you need.
Step 1, Install:
gem install crush
Step 2, Compress:
require "crush"
Crush.register
Tilt.new("application.js").render
# => compressed JavaScript...
If you look closely at the above example, you had to call Crush.register
before you could
use any of the engines. That's because, by default, Crush does not automatically register
its templates with Tilt. But, fear not, it's insanely easy to register them.
require "crush"
Crush.register
# or you can use this shortcut to do the same thing:
require "crush/all"
If you only want to use the JavaScript templates:
require "crush"
Crush.register_js
# or just:
require "crush/js"
CSS engines only:
require "crush"
Crush.register_css
# or, because I love shortcuts so much:
require "crush/css"
And finally, it's not hard to register only the ones you need, manually:
require "crush"
Tilt.register Crush::Uglifier, "js"
Tilt.register Crush::Rainpress, "css"
The included templates are actually subclasses of Crush::Engine
, which adds a few
methods somewhat common to compression libraries.
Crush::Engine.compress
takes the given string and immediately compresses it. It is also
aliased as compile
.
Crush::CSSMin.compress "body { color: red; }"
# => "body{color:red;}"
# Using Tilt's interface:
Tilt[:css].compress "body { color: red; }"
# => "body{color:red;}"
Crush::Engine
s do not require data from a file or block like Tilt::Template
s. They can
be initialized and given data through the Crush::Engine#compress
instance method, which
is also aliased as compile
.
engine = Crush::CSSMin.new
# Does not through an ArgumentError like a Tilt::Template
engine.compress "body { color: red; }"
# => "body{color:red;}"
Support fo these compression engines are included:
ENGINES EXTENSIONS REQUIRED LIBRARIES
-------------------------- ----------- -----------------------
JSMin .js jsmin
Packr .js packr
YUI::JavaScriptCompressor .js yui/compressor
Closure::Compiler .js closure-compiler
Uglifier .js uglifier
CSSMin .css cssmin
Rainpress .css rainpress
YUI::CssCompressor .css yui/compressor
Copyright (c) 2011 Peter Browne. See LICENSE for details.
FAQs
Unknown package
We found that crush demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.