{"id":21648674,"url":"https://github.com/phallguy/lash","last_synced_at":"2026-04-17T10:32:26.811Z","repository":{"id":56880765,"uuid":"1620942","full_name":"phallguy/lash","owner":"phallguy","description":"Static asset bundler for rails","archived":false,"fork":false,"pushed_at":"2011-04-21T01:11:50.000Z","size":3956,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-25T17:45:34.717Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phallguy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-04-15T21:28:47.000Z","updated_at":"2016-05-14T07:10:04.000Z","dependencies_parsed_at":"2022-08-20T13:00:41.938Z","dependency_job_id":null,"html_url":"https://github.com/phallguy/lash","commit_stats":null,"previous_names":["appsinyourpants/lash"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/phallguy/lash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phallguy%2Flash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phallguy%2Flash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phallguy%2Flash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phallguy%2Flash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phallguy","download_url":"https://codeload.github.com/phallguy/lash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phallguy%2Flash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31925400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T10:19:20.377Z","status":"ssl_error","status_checked_at":"2026-04-17T10:19:18.682Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T06:59:55.533Z","updated_at":"2026-04-17T10:32:26.794Z","avatar_url":"https://github.com/phallguy.png","language":"Ruby","readme":"# Lash\n\nTame your static assets without adding additional processing time on your server. Lash will\n\n* Bundle multiple JavaScript files into a single minified script.\n* Minify JavaScript files to be included on demand.\n* Build SASS style sheets using \"production\" settings.\n* Bundle loose PNG, GIF and JPEG files into a single CSS image sprite.\n* Optimize PNG files to reduce size by  5%-35%.\n* Generate static gzipped versions of static assets for use with nginx's `gzip_static` plugin. \n\nBased on [\"Optimizing asset bundling and serving with Rails\"](https://github.com/blog/551-optimizing-asset-bundling-and-serving-with-rails) at github.\n\n## Installation\n\n  \t# Gemfile\n  \tgem 'lash'\n\n\n\n\n\n## Bundling Assets\n\nLash includes several rake tasks to bundle loose, development versions of your static assets into minified and compressed versions. To bundle all assets simply run\n\n    rake lash:all                   # Runs all lash tasks including javascripts and style sheets\n    rake lash:deploy                # Called by capistrano to generate static assets on the server\n\nIndividual assets can be bundled on demand using their respective `lash:asset_type` tasks.\n\n\n\n\n\n## JavaScript\n\nLash expects to find JavaScript assets as subfolders of the public/javascripts folder like so\n\n* public/javascripts\n  * cdn\n  * demand\n  * application\n  * ie\n  \nFor each folder that lash finds, it will bundle all the .js files found in that folder into a single `bundle_#{folder}.js` file in the `public/javascripts` folder. For example, the following structure...\n\n* public/javascripts/application\n  * application.js\n  * utility.js\n  * rails.js\n  \n...will be bundled and minified into `public/javascripts/bundle_application.js` and a gzipped version `bundle_application.js.gz` in the same folder.\n\n### Special Folders\n\nLash recognizes two special folders: cdn and demand.\n\n__public/javascripts/cdn__\n:   Lash expects to find scripts that will normally be referenced via CDN (like the jquery via google's cdn) for local use during development mode and to support outages on the CDN.\n\n__public/javascripts/demand__\n:   Lash will not bundle scripts in the demand folder. Instead, each script is individually minified and gzipped in place. This is where you would put large scripts that you don't use on every page - like jquery.forms.\n\n### CDN JavaScripts and Developer Mode\n\nShared CDN hosts are great for optimizing your site's user experience but there are two issues that developers regularly have to deal with - developing offline and accounting for CDN unavailability. Lash handles both of these cases with ease.\n\nDuring development, Lash will use the copies of the libraries found in your public/javascripts/cdn directory. This makes it easy to work offline.\n\nIn production, Lash will use the CDN versions of the scripts and if a runtime test is provided, fallback to the local version if the CDN is unavailable.\n\n    \u003c%= javascript_cdn 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', 'jQuery' -%\u003e\n   \n    # =\u003e \u003cscript src=\"//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\n    # =\u003e \u003cscript type=\"text/javascript\"\u003e\n    # =\u003e  if(typeof jQuery === \"undefined\" ) \n    # =\u003e    document.write( unescape(\"\u003cscript src=\\\"/javascripts/cdn/jquery.min.js?1297459967\\\" type=\\\"text/javascript\\\"\u003e\u003c\\/script\u003e\") );\n    # =\u003e \u003c/script\u003e\n\n### Referencing JavaScript Bundles in Layouts\n\nTo include references to bundled scripts in a view simply call {Lash::BundleHelper#javascript_bundle}\n\n#### Example\n    \u003c%= javascript_bundle 'application', 'ie' %\u003e\n    \nWhen {Lash::BundleHelper#bundle_files?} is true (on by default in production), lash will include a reference to the single bundled script. When false, it will include each individual javascript that would have been bundled.\n\nSee {Lash::BundleHelper#javascript_bundle} for details.\n\n### application.bundleVersion.js\n\nWhen referring to assets in your javascripts you loose the convenience of the rails cache busting asset tags. During bundling, lash will generate an `public/javascripts/application/application.bundleVersion.js` which gets bundled into the application script. This script simply declares a global variable `bundleVersion` which you can append to asset urls in your scripts.\n\n#### Example\n  \n    $('#waiting-div').append( $('\u003cimg src=\"/images/wainting.gif?' + bundleVersion + '\" /\u003e' ) )\n\n### JavaScript bundling tasks\n\n    rake lash:js                    # Bundles and minifies javascripts\n    rake lash:js_bundle             # Bundles javascripts folders into single minified files\n    rake lash:js_gzip               # Compresses minified javascripts for nginx gzip_static support\n    rake lash:js_min                # Minifies all javascripts\n\n\n\n\n\n\n## CSS Sprites\n\nCSS sprites is are an effective optimization technique, but can be very time consuming to produce. Lash makes it easy. Just drop the desired images into a folder, run a rake task and you've got a highly optimized sprite image and accompanying CSS file.\n\nLash looks for sprite images in `public/sprites`. Each sub folder will be bundled into a single image and css file. Given the following folder structure:\n\n* public/sprites/ui\n  * accept.png\n  * add.png\n  \nLash will generate a sprite image `public/images/ui-sprite.png` and corresponding css file `public/stylesheets/sass/_ui-sprite.scss`.\n\n#### To generate your apps sprites\n\n    rake lash:sprites\n\n\n### _version.scss\n\nWhen referring to assets in your css scripts you loose the convenience of the rails cache busting asset tags. During bundling, lash will generate an `public/stylesheets/sass/_version.scss`. You can include this into any of your SASS scripts when you reference static assets like images. \n\n#### Example\n\n    @import 'version';\n    .smiley { background-image: url(/images/smiley.png?#{$bundle-version})}\n\n### CSS bundling tasks\n\n    rake lash:css        # Process CSS scripts\n    rake lash:css_gzip   # Compresses stylesheets for use with nginx gzip_static\n    rake lash:sass       # Pre-generate sass scripts\n    rake lash:sprites    # Generate CSS sprites from the public/sprites folders\n\n\n\n\n\n## Optimizing PNG Images\n\nMost image editors will compress PNG files using a very basic compression algorithm. However the PNG format \nallows for much more aggressive optimization at the cost of speed. Since image resources are some of the\nheaviest assets downloaded from your site, optimizing them is often worth the effort.\n\nSee [A guide to PNG optimization](http://optipng.sourceforge.net/pngtech/optipng.html) for a more detailed discussion.\n\n#### To optimize your pngs\n\n    rake lash:png\n    \n    \n    \n    \n\n## Integrating With Capistrano\n\nLash was designed to work with capistrano to easily run static asset bundling during the deployment process. This makes \nsure that all assets are primed for static serving from your website without interfering with any existing requests\nthat are currently being served.\n\n#### To run bundling tasks during deployment\n\n    # in config/deploy.rb\n    require 'lash/capistrano'\n \nIf you use capistrano to publish your app (and really who isn't?) you'll want to add some additional filters to your .gitignore file\n\n    # lash asset helpers\n    public/javascripts/common/application.bundleVersion.js\n    public/stylesheets/sass/_version.scss\n    \n    # lash generated filed\n    public/javascripts/bundle_*.js\n    public/stylesheets/*.css\n    public/stylesheets/sass/_*-sprite.scss\n    public/javascripts/**/*.min.js\n \n\n\n\n\n\n\n \n## License\n\n### Lash\n\nCopyright (C) 2011 Apps In Your Pants.\n\nDual licensed under MIT and GPLv3\n\n[Other License Notices](LICENSE.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphallguy%2Flash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphallguy%2Flash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphallguy%2Flash/lists"}