middleman-sprockets 4.0.0.rc.3 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/docs/usage-with-rails-assets.md +80 -0
- data/lib/middleman-sprockets/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86865e460e1617af5a3f81e9cc930942be536fa3
|
4
|
+
data.tar.gz: 802e29f35cf071c20ae0b1f1b4a5c9f3757290f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 336453668799d7142aedd42254284f2669be18621fce2155a5305458d60157b3d371f0997670dbc63478d1c39f2b9339d0215e737c6d3f7722ccc697acb9eab1
|
7
|
+
data.tar.gz: dee36dffef49106f12396092625551fafa3894e5a345212b7c873b09d7c42d18372f6ec6fc46adf23b13684f3c9bb9885079c72845ca82eff50c699edbd64e84
|
data/README.md
CHANGED
@@ -27,6 +27,7 @@ activate :sprockets
|
|
27
27
|
### Usage
|
28
28
|
|
29
29
|
- [Basic Usage](features/basic_usage.feature)
|
30
|
+
- [With Rails Assets](docs/usage-with-rails-assets.md)
|
30
31
|
- [With Asset Gems](features/asset_gems.feature)
|
31
32
|
- [With Bower](features/bower.feature)
|
32
33
|
- [Linked Assets](features/linked_assets.feature)
|
@@ -0,0 +1,80 @@
|
|
1
|
+
## Usage with Rails Assets
|
2
|
+
|
3
|
+
One of the simplest ways to use middleman-sprockets to manage frontend assets is via [Rails Assets](https://rails-assets.org). Rails Assets is a frictionless proxy between Bundler and Bower to manage Bower-based assets through your existing Gemfile, and then letting the asset pipeline handle the rest.
|
4
|
+
|
5
|
+
Here's a quick guide to using Rails Assets with a new Middleman 4 site:
|
6
|
+
|
7
|
+
1. Go to [rails-assets.org](https://rails-assets.org) and identify your dependency and version. Chances are it's already there; rails-assets then packages your dependency as a gem on demand for consumption by Bundler.
|
8
|
+
|
9
|
+
2. In your Gemfile, add sprockets and a rails-assets block with the gemfiles chosen from step 1:
|
10
|
+
|
11
|
+
```
|
12
|
+
# Gemfile
|
13
|
+
gem 'middleman-sprockets', '4.0.0.rc.3'
|
14
|
+
|
15
|
+
source 'https://rails-assets.org' do
|
16
|
+
gem 'rails-assets-bootstrap-autohidingnavbar', '1.0.0'
|
17
|
+
gem 'rails-assets-jquery', '2.1.1'
|
18
|
+
gem 'rails-assets-slick.js', '1.5.7'
|
19
|
+
end
|
20
|
+
```
|
21
|
+
|
22
|
+
3. In your config.rb, add the following block to enable the asset pipeline and add RailsAssets gems to your load path:
|
23
|
+
|
24
|
+
```
|
25
|
+
# config.rb
|
26
|
+
# General configuration
|
27
|
+
activate :sprockets
|
28
|
+
|
29
|
+
if defined? RailsAssets
|
30
|
+
RailsAssets.load_paths.each do |path|
|
31
|
+
sprockets.append_path path
|
32
|
+
end
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
4. run `bundle install`
|
37
|
+
|
38
|
+
5. Add the necessary import statements to your site.css.scss and all.js files. Note that rails-assets may suggest a sprockets `//= slick.js` import statement, but if the library is packaged with SASS, you likely want to use a SASS import `@import "slick.js";` instead.
|
39
|
+
|
40
|
+
|
41
|
+
You may run into edge cases where the assets in the generated gem are not packaged in a traditional way, or if you only need a subset of the library's functionality. In those cases, a quick
|
42
|
+
|
43
|
+
```
|
44
|
+
cd `bundle show gemname`
|
45
|
+
```
|
46
|
+
|
47
|
+
and opening up the library in your text editor will show you the necessary path & file information. In the example above, since slick.js ends with .js, make sure you specify the javascript import as:
|
48
|
+
|
49
|
+
```
|
50
|
+
//= require slick.js.js
|
51
|
+
```
|
52
|
+
|
53
|
+
Finally, note that you can still use traditional hand-packaged gems like bootstrap-sass and font-awesome-sass in your Gemfile as well. Here's a complete Gemfile for reference:
|
54
|
+
|
55
|
+
```
|
56
|
+
# If you do not have OpenSSL installed, change
|
57
|
+
# the following line to use 'http://'
|
58
|
+
source 'https://rubygems.org'
|
59
|
+
|
60
|
+
# For faster file watcher updates on Windows:
|
61
|
+
# gem 'wdm', '~> 0.1.0', platforms: [:mswin, :mingw]
|
62
|
+
|
63
|
+
# Windows does not come with time zone data
|
64
|
+
# gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby]
|
65
|
+
|
66
|
+
# Middleman Gems
|
67
|
+
gem 'middleman', '>= 4.0.0'
|
68
|
+
gem 'middleman-livereload'
|
69
|
+
gem 'middleman-compass', '>= 4.0.0'
|
70
|
+
gem 'middleman-sprockets', '4.0.0.rc.3'
|
71
|
+
|
72
|
+
gem 'bootstrap-sass'
|
73
|
+
gem 'font-awesome-sass'
|
74
|
+
|
75
|
+
source 'https://rails-assets.org' do
|
76
|
+
gem 'rails-assets-bootstrap-autohidingnavbar', '1.0.0'
|
77
|
+
gem 'rails-assets-jquery', '2.1.1'
|
78
|
+
gem 'rails-assets-slick.js', '1.5.7'
|
79
|
+
end
|
80
|
+
```
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-sprockets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Reynolds
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: middleman-core
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- README.md
|
77
77
|
- Rakefile
|
78
78
|
- docs/upgrade-3-to-4.md
|
79
|
+
- docs/usage-with-rails-assets.md
|
79
80
|
- features/asset_gems.feature
|
80
81
|
- features/basic_usage.feature
|
81
82
|
- features/bower.feature
|
@@ -167,9 +168,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
167
168
|
version: '0'
|
168
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
170
|
requirements:
|
170
|
-
- - "
|
171
|
+
- - ">="
|
171
172
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
173
|
+
version: '0'
|
173
174
|
requirements: []
|
174
175
|
rubyforge_project:
|
175
176
|
rubygems_version: 2.4.8
|