https://github.com/grimen/guard-packr
Guard for javascript compession/obfuscation using Packr. NOTE: Not maintained.
https://github.com/grimen/guard-packr
Last synced: 3 months ago
JSON representation
Guard for javascript compession/obfuscation using Packr. NOTE: Not maintained.
- Host: GitHub
- URL: https://github.com/grimen/guard-packr
- Owner: grimen
- Created: 2011-07-21T01:30:07.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2011-07-21T02:36:45.000Z (almost 14 years ago)
- Last Synced: 2025-01-12T06:11:21.602Z (4 months ago)
- Language: Ruby
- Homepage:
- Size: 89.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.textile
Awesome Lists containing this project
README
h1. GUARD-PACKR *alpha*
_Guard::Packr automatically compresses/obfuscates javascript files when modified (using Guard + Packr)._
h2. Installation
Add to your @Gemfile@:
gem 'guard-packr'...and @bundle install@.
*Dependencies:*
* *"guard":http://github.com/guard/guard*
* *"packr":http://github.com/jcoglan/packr*...you will need, but installed by *Bundler* they will be. - Yoda
h2. Setup
Use the *Guard* generator:
$ guard init packr...to generate default *Packr*-guard (with notes) into your @Guardfile@
h2. Usage
In your @Guardfile@, something like:
guard 'packr', :extension => '.packed.js', :shrink_vars => true, :private => true, :base62 => false, :protect => %w[_this that] do
# == IMPORTANT:
#
# - Ensure that you don't write rules that owerwrite your source files!
# To avoid that either use custom "extension" (see above), or temporarily
# generated files as source (e.g. app/assets/javascripts => tmp/javascripts).
#
# - This guard should be placed after any javascript processing (guard-sprockets, guard-jammit, etc.)
# within your Guardfile - naturally (Packr makes no sense for pre-processing javascript).
#
watch('tmp/javascripts/.*\.js')
endTo read more about the *Packr*-options, see "Packr":https://github.com/jcoglan/packr.
When in doubt, see "Guard":https://github.com/guard/guard.
h2. Options
:extension => '.packed.js' # File-extension for the packed javascript file.
:shrink_vars => true, # Compress local variable names.
:private => true, # Obfuscate 'private' identifiers, i.e. names beginning with a single underscore.
:base62 => false, # Encode the program using base 62.
:protect => %w[_this that] # Variable names to protect from compression.h2. Notes
This gem was developed for a tiny special case at *"Merchii":http://github.com/merchii*, so feel free to send pull-requests with enhancements of any kind (features, bug-fixes, documentation, tests, etc.) to make it better or useful for you as well.
h2. License
Released under the MIT license.
Copyright (c) "Merchii":http://github.com/merchii, "Jonas Grimfelt":http://github.com/grimen