This repository has been archived by the owner on May 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfig.rb
62 lines (49 loc) · 1.43 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
58
59
60
61
62
activate :blog do |blog|
blog.permalink = "/{title}.html"
blog.layout = "article"
end
activate :directory_indexes
activate :autoprefixer, browsers: [
"last 2 versions"
]
activate :external_pipeline,
name: :webpack,
command: build? ? "npm run build" : "npm start",
source: ".tmp/dist",
latency: 1
# Reload the browser automatically whenever files change
configure :development do
set :domain_name, "http://localhost:4567"
activate :livereload
end
# Build-specific configuration
configure :build do
# "Ignore" JS and CSS so webpack has full control.
ignore { |path| path =~ /\/(.*)\.js|css$/ && $1 != "all" && $1 != "vendor" }
# Minify Javascript on build
activate :minify_javascript
# For example, change the Compass output style for deployment
activate :minify_css
# 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