Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
= rake-minify
Rake Minify is an extremely simple solution for minifying javascript and coffeescript files using a rake task.
{}[http://travis-ci.org/mcollina/rake-minify]
== Installation
First, install the gem:
gem install rake-minify
Or if your are using Bundler:
echo "gem 'rake-minify'" >> Gemfile bundle install
== Minifying a single JavaScript file
Open your Rakefile and add:
require 'rake/minify' Rake::Minify.new(:minify_single) do dir("path/to/your/dir") do # we specify only the source directory add("output.js", "source.js") # the output file name is full path end end
This task minify the file "path/to/your/dir/source.js" into the file "output.js".
== Minify multiple JavaScript files
Open your Rakefile and add:
require 'rake/minify' Rake::Minify.new(:minify_multiple) do dir("path/to/your/dir") do # we specify only the source directory group("output-multi.js") do # the output file name is full path add("first.js") add("second.js") end end end
This task packs and minify the files "path/to/your/dir/first.js" and "path/to/your/dir/second.js" into the file "output-multi.js".
== Combine only multiple JavaScript files
Open your Rakefile and add:
require 'rake/minify' Rake::Minify.new(:minify_and_combine) do dir("path/to/your/dir") do # we specify only the source directory group("output-first-second.js") do add("first.js", :minify => false) # this file is not minified add("second.js") end end end
== CoffeeScript support
The rake-minify gem now supports even CoffeeScript files to be compiled, minified and bundled, just include them like javascript files.
CoffeeScript support requires the coffe-script gem, so install the gem:
gem install coffee-script
Or if your are using Bundler:
echo "gem 'coffee-script'" >> Gemfile bundle install
Then open your Rakefile and add:
require 'rake/minify' Rake::Minify.new(:minify_single) do dir("path/to/your/dir") do # we specify only the source directory add("output.js", "source.coffee") # the coffee file is compiled and minified end end
=== Bare switch
Since version 0.3.0 rake-minify support the configuration of the coffee script bare switch (see http://jashkenas.github.com/coffee-script/#installation for details). However in the 0.2.x series that flag defaulted to true, now it defaults to false.
You can specify it:
require 'rake/minify' Rake::Minify.new(:minify_single) do # the coffee file is compiled and minified # without the top-level function safety wrapper. add("output.js", "source.coffee", :bare => true) end
== Combine from ruby block
With a single file:
require 'rake/minify' Rake::Minify.new(:minify_single) do dir("path/to/your/dir") do # we specify only the source directory add("output.js") do # this is evaluated during the build "var a = 'hello js!'" end end end
With a group:
require 'rake/minify' Rake::Minify.new(:minify_and_combine) do dir("path/to/your/dir") do # we specify only the source directory group("output-first-second.js") do add(:minify => false) do # this is evaluated during the build "var a = 'hello js!'" end
add(:coffeescript => true) do
# this is evaluated as coffescript
"(a -> 'hello coffee!')()"
end
end
end
end
== Contributing to rake-minify
== Copyright
Copyright (c) 2011 Matteo Collina. See LICENSE.txt for further details.
FAQs
Unknown package
We found that rake-minify 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.