forked from diorman/DBDesigner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
51 lines (37 loc) · 1.26 KB
/
Rakefile
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
namespace :js do
desc 'Compile Javascript, pmts => c: Compress'
task :compile, :pmts do |t, args|
require 'sprockets'
require 'uglifier'
args.with_defaults(pmts: '')
environment = Sprockets::Environment.new
environment.append_path 'core/classes'
environment.append_path 'js'
file_content = environment.find_asset('manifest.js').to_s
file_content = Uglifier.compile(file_content, comments: :none) if args[:pmts].index('c')
File.open('js/dbdesigner.js', 'w') do |f|
f.write(file_content)
end
end
end
namespace :css do
desc 'Compile Sass, pmts => c: Compress, f: Force'
task :compile, :pmts do |t, args|
require 'compass'
require 'compass/exec'
args.with_defaults(pmts: '')
params = ['compile', '--css-dir', 'css', '--sass-dir', 'sass', '--images-dir', 'images', '--relative-assets']
params.push('--output-style', 'compressed') if args[:pmts].index('c')
params.push('--force') if args[:pmts].index('f')
Compass::Exec::SubCommandUI.new(params).run!
end
end
namespace :assets do
desc 'Compile Assets, pmts => c: Compress, f: Force'
task :compile, :pmts do |t, args|
args.with_defaults(pmts: 'cf')
Rake::Task['js:compile'].invoke(args[:pmts])
Rake::Task['css:compile'].invoke(args[:pmts])
end
end
task :default => ['assets:compile']