Code Monkey home page Code Monkey logo

goclosure's Introduction

goClosure

A simple utility to concat and minify javascript files via the Google Closure compiler API.

If you just want a simple binary or go solution for minifying javascript, or if you just don't want or can't install Node.js to use Grunt or Gulp, then goClosure is for you.

go install

go install github.com/nullboundary/goClosure

Usage

COMMANDS:
   concat, c	Read an html file and concat the js files in order
   minify, m	Minify one js file via Google Closure Compiler API
   all, a	Both Concat and Minify. Input is same as concat
   help, h	Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h		show help
   --version, -v	print the version

Concat javascript files into one file

NAME:
   concat - Read an html file and concat the js files in order

USAGE:
   command concat [command options] [arguments...]

DESCRIPTION:
   goClosure concat <input html file> <output js file>

OPTIONS:
   --path, -p "none"	Changes the path root for the js files listed in the html input file. Syntax <oldPath>:<newPath>
   --modify, -m "none"	Changes input html file <script> tags replacing the many old js files with one concated new file

Create or use an html file that lists your js files in the order you would like to concat them.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Sample</title>
</head>
<body>
  <p>Go Closure</p>
  <script type="text/javascript" src="/assets/js/earlyload.js"></script>
  <!-- External libraries will be ignored -->
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  <!-- -p oldpath:newpath flag can replace the file path to match the local directory -->
  <script type="text/javascript" src="/assets/js/lib.js"></script>
  <script type="text/javascript" src="/assets/js/site.js"></script>
</body>
</html>

Example:

goClosure concat index.html site.min.js -m /assets/js -p /assets/:www/

Minify one js file via Google Closure Compiler API

NAME:
   minify - Minify one js file via Google Closure Compiler API

USAGE:
   command minify [arguments...]

DESCRIPTION:
   goClosure minify <inputfile> <outputfile>

OPTIONS:
    --advanced, -a	sets compilation level to advanced
    --whitespace, -w	sets compilation level to white space only

Example:

goClosure minify -w site.js site.min.js

Concat and Minify

NAME:
   all - Both Concat and Minify. Input is same as concat

USAGE:
   command all [command options] [arguments...]

DESCRIPTION:
   goClosure all <input html file> <output js file>

OPTIONS:
   --path, -p "none"	Changes the path root for the js files listed in the html input file. Syntax <oldPath>:<newPath>
   --modify, -m "none"	Changes input html file <script> tags replacing the many old js files with one concated new file
   --advanced, -a	sets compilation level to advanced
   --whitespace, -w	sets compilation level to white space only

Example:

goClosure all -a index.html site.min.js -m /assets/js -p /assets/:www/

goclosure's People

Contributors

nullboundary avatar

Stargazers

 avatar  avatar

Watchers

 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.