Giter Club home page Giter Club logo

guard-packr's Introduction

GUARD-PACKR alpha

Guard::Packr automatically compresses/obfuscates javascript files when modified (using Guard + Packr).

Installation

Add to your Gemfile:

  gem 'guard-packr'

…and bundle install.

Dependencies:

…you will need, but installed by Bundler they will be. – Yoda

Setup

Use the Guard generator:

  $ guard init packr

…to generate default Packr-guard (with notes) into your Guardfile

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')
  end

To read more about the Packr-options, see Packr.

When in doubt, see Guard.

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.

Notes

This gem was developed for a tiny special case at 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.

License

Released under the MIT license.
Copyright © Merchii, Jonas Grimfelt

guard-packr's People

Contributors

grimen avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.