![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
rails_asset_packager
Advanced tools
= RailsAssetPackager
Rails Asset Packager provides an easy way to combine and compress stylesheets and Javascript files to improve performance for production environments. The packager also provides a convenient way to push those packed files, along with any other static assets to Amazon S3.
== Description
When it comes time to deploy your new web application, instead of sending down a dozen JavaScript and CSS files full of formatting and comments, this Rails plugin makes it simple to merge and compress JavaScript and CSS down into one or more files, increasing speed and saving bandwidth.
When in development, it allows you to use your original versions and retain formatting and comments for readability and debugging.
This code is released under the MIT license (like Ruby). You're free to rip it up, enhance it, etc. And if you make any enhancements, I'd like to know so I can add them back in. Thanks!
== Credit
This gem is derived directly from the work of Scott Becker and Katherine G Pe on the AssetPackager plugin for Rails.
== Key Features
== Components
== Updates
January 2011:
== How to Use:
Add the gem to your Gemfile gem "rails_asset_packager"
Run the rake task "asset:packager:create_yml" to generate the /config/asset_packages.yml file the first time. You will need to reorder files under 'base' so dependencies are loaded in correct order. Feel free to rename or create new file packages.
IMPORTANT: JavaScript files can break once compressed if each statement doesn't end with a semi-colon. The minifier puts multiple statements on one line, so if the semi-colon is missing, the statement may no longer makes sense and cause a syntax error.
== Examples of config/asset_packages.yml
Example from a fresh rails app after running the rake task. (Stylesheets is blank because a default rails app has no stylesheets yet.):
javascripts:
Multiple packages:
javascripts:
Merging and compressing is expensive, so this is something we want to do once, not every time your app starts. Thats why its a rake task. You can run this task via Capistrano when deploying to avoid an initially slow request the first time a page is generated.
Note: The package will be generated on the fly if it doesn't yet exist, so you don't need to run the rake task when deploying, its just recommended for speeding up initial requests.
Note: You need to have a file at config/s3.yml that defines your Amazon S3 access credentials.
Use the helper functions whenever including these files in your application. See below for examples.
Potential warning: css compressor function currently removes CSS comments. This might blow away some CSS hackery. To disable comment removal, comment out /lib/synthesis/asset_package.rb line 176.
== JavaScript Examples
Example call (based on above /config/asset_packages.yml): <%= javascript_include_merged :base %>
In development, this generates:
In production, this generates:
== Stylesheet Examples
Example call: <%= stylesheet_link_merged :base %>
In development, this generates:
In production this generates:
== Different CSS Media
All options for stylesheet_link_tag still work, so if you want to specify a different media type: <%= stylesheet_link_merged :secondary, 'media' => 'print' %>
== Rake tasks
rake asset:packager:build_all # Merge and compress assets rake asset:packager:create_yml # Generate asset_packages.yml from existing assets rake asset:packager:delete_all # Delete all asset builds rake asset:cache:s3 # update s3 rake asset:cache:production # cache assets and update s3 for production
== License Copyright (c) 2006-2008 Scott Becker - http://synthesis.sbecker.net Copyright (c) 2011 James Thompson - james@plainprograms.com Contact via Github for change requests, etc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Unknown package
We found that rails_asset_packager demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.