-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssetfile
84 lines (73 loc) · 2.87 KB
/
Assetfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# All of rake-pipeline's web goodness lives here.
require "rake-pipeline-web-filters"
require "json"
require "uglifier"
# All of our outputs will be relative to the `public/`
# directory.
output "public"
# All of our inputs to the pipeline live under the `app/`
# directory. We could also specify a glob if we wanted to
# limit the files in that directory, e.g.:
#
# input "app", "**/*.scss"
#
# would limit the input to just scss files. All of our paths
# inside this Assetfile will be relative to this directory.
input "app" do
# Here we specify a match block so we can apply a filter to
# a subset of the files in our input directory. We're turning
# our handlebars template files into javascript files.
match "**/*.handlebars" do
handlebars
end
# Now we match all the rest of the JavaScript files. Because the
# outputs of our handlebars filter are JavaScript files, those
# will get matched by this block, too.
match "javascripts/**/*.js" do
# The minispade helper wraps each JS file in some code to
# register it with the [minispade](https://github.com/wycats/minispade)
# module loader.
minispade :rewrite_requires => true,
:module_id_generator => proc { |input|
# The `:module_id_generator` option customizes the name each file
# gets registered under. Here we're changing a name like this:
# javascripts/vendor/ember.js
# into:
# checklist/vendor/ember
#
# So using minispade, we can write:
# minispade.require('checklist/vendor/ember');
# in our JS when we want to load ember.js.
input.path.sub(/javascripts\//, 'checklist/').sub(/\.js$/, '')
}
# Minify the Javascript
#uglify
# After being wrapped in the minispade code, we want to concatenate
# all the javascript files together.
concat "js/app.js"
end
# Now for our stylesheets. We're using Sass. We want to use
# Sass's `@import` statement to control the order in which our
# stylesheets get loaded, so we only match a single master
# .scss file, and use `@import` from there to load the rest.
match "stylesheets/checklist.scss" do
# The `:additional_load_paths` option lets us tell Sass that
# it should look in our styles directory to find `@import`s.
scss :additional_load_paths => "app/stylesheets"
# We're only matching a single file here, but we want it to
# end up in our stylesheets/ directory.
copy "stylesheets/checklist.css"
end
# Finally, we keep our static assets that don't need any processing
# in a `static/` directory.
match "static/**/*" do
# The block we pass to `concat` lets us adjust the output path
# of any files it matches. Here we take each input and strip
# off the `static/` prefix, so `app/static/index.html` ends up
# in `public/index.html`.
concat do |input|
input.sub(/static\//, '')
end
end
end
# vim:ft=ruby