sprockets
Version, currently master branch1 version
- master branchlatestDec 17, 2022
github.com/gummybears/sprockets
No description declared in shard.yml.
Installation
# Add this to your shard.yml
dependencies:
sprockets:
github: gummybears/sprockets
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
- no constraint declared
Dependencies
Runtime Dependencies
- sass0.6.0github: straight-shoota/sass.cr
- duktape*github: jessedoyle/duktape.cr
- coffee-script~> 1.0github: jessedoyle/coffee-script
README
sprockets
A really simple assets manager.
Installation
-
Add the dependency to your
shard.yml:dependencies: sprockets: github: gummybears/sprockets -
Run
shards install
Usage
require "sprockets"
To precompile assets, you could write a small program as follows
require "sprockets"
args = ARGV
if args.size == 0 || args.size > 1
puts "usage : precompile config.yml"
exit
end
filename = args[0]
if File.exists?(filename) == false
puts "file #{filename} not found"
exit
end
config = Sprockets::Config.new(filename)
s = Sprockets::Sprocket.new(config)
s.precompile_assets()
given the following configuration
mode: development
root_dir: <WORKDIR>
# assets configuration
assets:
#
# a flag that enables the creation of gzipped version of compiled assets,
# along with non-gzipped assets. Set to true by default.
#
gzip: false
#
# enables the use of SHA256 fingerprints in asset names. Set to true by default.
#
digest: true
#
# setting quiet to false will generate terminal output showing which files are preprocessed
#
quiet: true
#
# version is optional, but when set is used in SHA256 hash generation,
# which will force all files to be recompiled.
#
version:
#
# defines the prefix where assets are served from. Defaults to /assets
#
prefix: /assets
public:
# relative path, relative to the root directory
dir: public
# absolute path
# dir: /your_directory/public
#
# location of your asset sources
# Note: source filenames should be unique
#
source:
dirs:
- app/assets
- lib/assets
- vendor/assets
Development
Minification CSS stylesheets implemented. Hot reloading of assets can be implemented via middleware, see the next example for the Kemal framework.
class ReloadAssets < Kemal::Handler
def call(env)
if Kemal.config.env == "development"
puts "[development] precompiling assets"
filename = "src/assets.yml"
config = Sprockets::Config.new(filename)
s = Sprockets::Sprocket.new(config)
s.precompile_assets()
end
call_next env
end
end
add_handler ReloadAssets.new
Running the tests
To run the tests, create a symbolic link gummybears to point to your home or working directory.
$ cd /home; mkdir gummybears
$ cd /home; ln -s $HOME gummybears
$ crystal spec
Contributing
- Fork it (https://github.com/gummybears/sprockets/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- gummybears - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Dec 17, 2022
- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/gummybears/sprockets
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 14, 2026
- Synced
- Aug 14, 2026
- Versions
- 1