Name: middleman-sprockets
Owner: Le Wagon
Description: Sprockets support for Middleman
Forked from: middleman/middleman-sprockets
Created: 2017-07-27 14:55:08.0
Updated: 2017-07-27 14:55:09.0
Pushed: 2017-07-27 15:04:31.0
Homepage: http://middlemanapp.com
Size: 826
Language: Gherkin
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
The master branch is the 4.x version of Middleman-Sprockets.
- If you're upgrading from 3.x, the upgrading guide should get you started.
- For 3.x stable usage please see the
v3-stable-real
branch
middleman-sprockets
is an extension for the Middleman static site generator that allows support for Sprockets in your assets.
If you're just getting started, install the middleman
gem and generate a new project:
install middleman
leman init MY_PROJECT
Then add gem "middleman-sprockets"
to your Gemfile
and run bundle install
To activate the extension, in your config.rb
add:
vate :sprockets
There are currently two options for configuration, imported_asset_path
and expose_middleman_helpers
.
imported_asset_path
[default: 'assets']
This is the path imported/linked assets will be added to the sitemap. For example, in the bower fixture app, the /javascripts/core.js
file has //= link "lightbox2/img/close.png"
. This linked asset will be added to the sitemap at /assets/lightbox2/img/close.png
.
To configure, in config.rb
:
vate :sprockets do |c|
imported_asset_path = "YOUR_PATH"
You can also pass an object (proc/lambda/class) that responds to #call
to imported_asset_path
to conditionally determine where assets go.
vate :sprockets do |c|
imported_asset_path = ->(sprockets_asset) do
if sprockets_asset.logical_path =~ /\.js$/
# all files ending with .js get put in /vendor-js
File.join('vendor-js', sprockets_asset.logical_path)
else
# other assets head to /imported
File.join('imported', sprockets_asset.logical_path)
end
d
View the imported_asset_processor test for an example using a class.
expose_middleman_helpers
[default: false]
Sometimes you might need sprockets to have access helpers (for example using different keys depending on deployment environment). Getting this to happen is bound to be full of edge cases, so for now it's behind a configuration option.
If you need Middleman helpers in your Sprockets, in config.rb
:
vate :sprockets do |c|
expose_middleman_helpers = true
The official community forum is available at: http://forum.middlemanapp.com
Github Issues are used for managing bug reports and feature requests. If you run into issues, please search the issues and submit new problems: https://github.com/middleman/middleman-sprockets/issues
The best way to get quick responses to your issues and swift fixes to your bugs is to submit detailed bug reports, include test cases and respond to developer questions in a timely manner. Even better, if you know Ruby, you can submit Pull Requests containing Cucumber Features which describe how your feature should work or exploit the bug you are submitting.
git clone https://github.com/middleman/middleman-sprockets.git
gem install bundler
bundle install
inside the project root to install the gem dependencies.bundle exec rake test
Click here to lend your support to Middleman
Copyright (c) 2012-2016 Thomas Reynolds. MIT Licensed, see LICENSE for details.