This repository has been archived by the owner on Oct 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAssetFile
71 lines (57 loc) · 1.86 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
# credits to http://stackoverflow.com/a/8564949/296042
require "json"
require "uglifier"
require "rake-pipeline-web-filters"
# this gives you concat, coffee_script, and minispade methods
require "rake-pipeline-web-filters/helpers"
class HandlebarsFilter < Rake::Pipeline::Filter
def initialize(&block)
block ||= proc { |input| input.sub(/\.handlebars$/, '.js') }
super(&block)
end
def generate_output(inputs, output)
inputs.each do |input|
output.write "return Ember.Handlebars.compile(#{input.read.to_json})"
end
end
end
# process all js, css and html files in app/assets
input "assets"
# processed files should be outputted to public
output "public"
match "libs/*.js" do
concat [
"js/libs/jquery.js",
"js/libs/ember.js",
"js/libs/minispade.js"
], "application.libs.js"
end
# process all coffee files
#match "**/*.coffee" do
match "js/{models,controllers,views,states}/**/*.js" do
# compile all CoffeeScript files. the output file
# for the compilation should be the input name
# with the .coffee extension replaced with .js
#coffee_script
#filter Rake::Pipeline::Web::Filters::CoffeeScriptFilter
filter Rake::Pipeline::Web::Filters::MinispadeFilter,
:module_id_generator => proc { |input| input.path.sub(/js\//, '').sub(/\.js$/, '') }
filter Rake::Pipeline::ConcatFilter, "application.scripts.js"
end
# Take all SCSS inputs and compile them with Sass
#match "*.scss" do
# filter Rake::Pipeline::Web::Filters::SassCompiler
#end
match "**/*.handlebars" do
filter HandlebarsFilter
minispade :module_id_generator => proc { |input| input.path.sub(/js\//, '').sub(/\.js$/, '') }
concat "application.templates.js"
end
match "*.js" do
#if ENV['RAKEP_ENV'] == "production"
#uglify
concat ["application.libs.js", "application.templates.js", "application.scripts.js"], "js/application.js"
#else
# concat
#end
end