{"id":19142195,"url":"https://github.com/eldoy/asset","last_synced_at":"2026-04-18T00:05:02.252Z","repository":{"id":59150756,"uuid":"77717940","full_name":"eldoy/asset","owner":"eldoy","description":"Compress and serve your JS and CSS files. Asset handling has never been easier.","archived":false,"fork":false,"pushed_at":"2020-01-24T08:26:51.000Z","size":244,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-01T08:05:00.258Z","etag":null,"topics":["asset-packer","asset-pipeline","assets","compress","compressed","css","js","middleware","rack","ruby","uglify"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eldoy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-31T00:42:54.000Z","updated_at":"2022-06-04T21:53:12.000Z","dependencies_parsed_at":"2022-09-13T10:50:21.172Z","dependency_job_id":null,"html_url":"https://github.com/eldoy/asset","commit_stats":null,"previous_names":["fugroup/asset"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fasset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fasset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fasset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fasset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldoy","download_url":"https://codeload.github.com/eldoy/asset/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240223214,"owners_count":19767597,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["asset-packer","asset-pipeline","assets","compress","compressed","css","js","middleware","rack","ruby","uglify"],"created_at":"2024-11-09T07:26:17.418Z","updated_at":"2026-04-18T00:05:02.206Z","avatar_url":"https://github.com/eldoy.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asset compresses and serves your CSS and JS files\n\nCompress and cache your Javascript and CSS files automatically.\n\nSet up your manifest file, install the helpers and the middleware, and you're up and running with compressed assets served lightning fast on pure Rack.\n\nAll assets are loaded only once, and then stored in the browser disk cache, making your pages load in milliseconds. This is a must-have for any web site.\n\n### Installation\n```\ngem install asset\n```\nor add to Gemfile. In your Rack app include the line\n```ruby\n# Rack apps\ninclude Asset::Router\n\n# Sinatra\nhelpers Asset::Router\n```\n\n### Settings\n```ruby\n# Default is production\n@mode = ENV['RACK_ENV'] || 'production'\n\n# Where your assets live\n@path = File.join(Dir.pwd, 'app', 'assets')\n\n# Where to write the cache, default to ./tmp\n@cache = File.join(Dir.pwd, 'tmp')\n\n# Automatically bounce (404) for browser /favicon.ico requests\n@favicon = true\n\n# Send /robots.txt to a standard robots txt with reference to /sitemap.xml\n@robots = true\n\n# Reload the assets on change in development mode\n@listener = true\n\n# Follow symlinks in assets\n@symlinks = true\n\n# Debug option\n@debug = false\n```\n\n### Usage\n```yaml\n# Install your manifest file in APP_ROOT/app/assets/manifest.yml\n\n# Asset manifest. Only the files mentioned here will be bundled.\ncss:\n- app.css\n- themes/themes.css\n\njs:\n- app.js\n- lib/cookie.js\n```\n\n```erb\n# After setting up the manifest file, use the helpers in your views\n\u003c%= script_tag 'app.js' %\u003e\n\u003c%= style_tag 'app.css' %\u003e\n\n# Multiple\n\u003c%= script_tag 'app.js', 'lib/cookies.js' %\u003e\n\n# Bundle all Javascript files with 'bundle.js'\n\u003c%= script_tag 'bundle.js' %\u003e\n\n# Bundle all CSS files with 'bundle.css'\n\u003c%= script_tag 'bundle.css' %\u003e\n```\n\nIn development mode, all files will be loaded. In production mode, you'll load only one file.\n\nThe file will also be cached and compressed. The cache auto-expires.\n\n### Middleware\nThe Asset gem also comes with Rack middleware to handle requests for your assets.\n\n```ruby\n# Insert the asset middleware early in the stack\nuse Asset::Router\n\n# Full example from the config.ru file\n\n# Set up middleware stack\napp = Rack::Builder.new do\n\n  # Use Rack::Cache to enable 304 for last modified\n  use Rack::Cache\n\n  # Include the Asset middleware router\n  use Asset::Router\n\n  # Use this setup to have files served from /assets/images and /assets/fonts\n  use Rack::Static, :urls =\u003e ['/images', '/fonts'], :root =\u003e APP_ASSETS,\n    :header_rules =\u003e [\n      [:all, {'Cache-Control' =\u003e 'public, max-age=31536000'}],\n      [:fonts, {'Access-Control-Allow-Origin' =\u003e '*'}]\n    ]\n  run App # Your app goes here\nend\n\n# Run app\nrun app\n\n# Files will be available here on your server (HTTP):\n/assets/js/app.js\n/assets/js/lib/app.js\n/assets/css/app.css\n/assets/css/themes/dark.css\n\n# You can also drop the /assets in front\n/js/app.js\n/css/app.css\n```\n\nThe helpers will generate these URLs, so you don't have to worry about it.\n\n### Images and fonts\n\nTo include support for other static file types likes images and fonts, use [Rack::Static,](https://github.com/rack/rack/blob/master/lib/rack/static.rb) see the example above.\n\n\nWe've included an image tag helper too for this use:\n```erb\n# Use this in your application, will default to APP_ROOT/assets/images\n\u003c%= image_tag 'logo.png' %\u003e\n```\n\n### Contribute\n\nCreated and maintained by [Eldøy Projects](https://eldoy.com)\n\n`@authors: Vidar`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fasset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldoy%2Fasset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fasset/lists"}