Giter Club home page Giter Club logo

minish's Introduction

Minish

Simple helper written in Go to hash JavaScript file name. Hashed names help to load newest file with the web page. Hashed names allow to utilize long cache expiration times, e.g. Cache-Control:max-age=2592000.

Makes sure that latest JavaScript files are loaded. After minishing javascript files, browsers, CDNs and other caching proxies will not prevent loading the latest versions of your application.

Load hashed JavaScript file

Removes previously minified files from the output folder that ends with the -.min.js | .min.css

Examples:

go run main.go example.js dist

=> dist/3a25a3cfb1481a9b3496ca870564dff5-example.min.js

go run main.go -css example.css dist

=> dist/d560e98e1b167635837291f8e54628e3-example.min.css

Snippets

Snippets directory contains utils that can be used to find minished files in Go and Scala. Those can be used find latest hashed version e.g. on web application boot.

Usage

# Minifies example.js as dist/<md5sum>-example.min.js
./minish example.js dist
# Minifies example.js and second.js concatenated as dist/<md5sum>-bundle.js
./minish example.js,second.js dist/bundle.js
# Minifies css example.css as dist/<md5sum>-example.min.css
./minish -css example.css dist
# Minifies css example.css as dist/<md5sum>-example-test.css
./minish -css example.css dist/example-test.css

Dependencies

Install UglifyJS2

https://github.com/mishoo/UglifyJS2

install clean-css

https://github.com/jakubpawlowicz/clean-css

minish's People

Contributors

saikitanabe avatar

Watchers

James Cloos 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.