generated from remino/template-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.rb
94 lines (79 loc) · 2.06 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
require 'terser'
activate :directory_indexes
activate :livereload
activate :autoprefixer do |prefix|
prefix.browsers = 'last 2 versions'
end
configure :build do
activate :asset_hash, exts: %w(.css .js)
activate :gzip
activate :minify_javascript, compressor: Terser.new
after_configuration do
use ::HtmlCompressor::Rack,
if: :use_middleware?,
compress_css: true,
compress_javascript: true,
css_compressor: :yui,
enabled: true,
javascript_compressor: Terser.new,
preserve_line_breaks: false,
preserve_patterns: [],
remove_comments: true,
remove_form_attributes: false,
remove_http_protocol: false,
remove_https_protocol: false,
remove_input_attributes: true,
remove_intertag_spaces: true,
remove_javascript_protocol: true,
remove_link_attributes: true,
remove_multi_spaces: true,
remove_quotes: true,
remove_script_attributes: true,
remove_style_attributes: true,
simple_boolean_attributes: true,
simple_doctype: false
end
activate :external_pipeline,
name: :img,
command: "bin/build_images #{app.source_dir} .build/img",
source: ".build/img",
latency: 2
after_build do |builder|
builder.thor.run 'bin/build_brotli build'
end
before_build do |builder|
builder.thor.run 'npm run js:build'
end
ignore '/nav/*'
ignore '/index.html'
end
activate :external_pipeline,
name: :css,
command: "npm run #{build? ? 'css:build' : 'css:watch'}",
source: ".build/css",
latency: 2
activate :external_pipeline,
name: :js,
command: "npm run #{build? ? 'js:build' : 'js:watch'}",
source: ".build/js",
latency: 2
helpers do
def use_middleware?(path)
puts 'path: ' + path
path != '/scrollerful/demo/simple/index.html'
end
end
ignore '.DS_Store'
page '/*.json', layout: false
page '/*.txt', layout: false
page '/*.xml', layout: false
page '/scrollerful/demo/readme.html', layout: false
prefix = '/scrollerful'
set :source, 'pages'
set :build_dir, 'build'
set :css_dir, prefix
set :haml, { format: :html5 }
set :images_dir, prefix
set :js_dir, prefix
set :partials_dir, prefix
set :relative_links, false