-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.rb
58 lines (44 loc) · 1.31 KB
/
config.rb
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
activate :scss_lint
activate :autoprefixer, browsers: [
'last 2 versions'
]
activate :external_pipeline,
name: :webpack,
command: build? ? './node_modules/webpack/bin/webpack.js --bail' : './node_modules/webpack/bin/webpack.js --watch -d',
source: ".tmp/dist",
latency: 1
# Reload the browser automatically whenever files change
configure :development do
activate :livereload
end
# Build-specific configuration
configure :build do
# For example, change the Compass output style for deployment
activate :minify_css
# "Ignore" JS so webpack has full control.
ignore { |path| path =~ /\/(.*)\.js$/ && $1 != 'all' }
# Minify Javascript on build
activate :minify_javascript
# Enable cache buster
# activate :asset_hash
# Use relative URLs
activate :relative_assets
config[:relative_links] = true
# Or use a different image path
# set :http_prefix, "/Content/images/"
end
configure :server do
ready do
files.on_change :source do |changed|
changed_js = changed.select do |f|
f[:full_path].extname === '.js' && !f[:full_path].to_s.include?('.tmp')
end
if changed_js.length > 0
puts "== Linting Javascript"
changed_js.each do |file|
puts `./node_modules/eslint/bin/eslint.js #{file[:full_path]}`
end
end
end
end
end