Class: Cyborg::Assets::Javascripts
Instance Attribute Summary
Attributes inherited from AssetType
#base, #plugin
Instance Method Summary
collapse
Methods inherited from AssetType
#build_msg, #change, #destination, #file_event, #filter_files, #find_files, #find_node_module, #initialize, #npm_command, #url, #urls, #versioned, #watch
Instance Method Details
#asset_tag(*args) ⇒ Object
8
9
10
|
# File 'lib/cyborg/plugin/assets/javascripts.rb', line 8
def asset_tag(*args)
javascript_include_tag(args)
end
|
#build ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/cyborg/plugin/assets/javascripts.rb', line 12
def build
if find_node_module "browserify"
find_files.each do |file|
dest = destination(file).sub(/\.js$/,'')
npm_command "browserify #{file} -t babelify --standalone #{plugin.module_name} -o #{dest}.js -d -p [ minifyify --map #{url(file)}.map.json --output #{dest}.map.json ]"
puts build_msg(file)
end
else
abort "JS BUILD FAILED: browserify NPM module not found.\n" << "Please add browserify to your package.json and run `npm install`"
end
end
|
#ext ⇒ Object
4
5
6
|
# File 'lib/cyborg/plugin/assets/javascripts.rb', line 4
def ext
"js"
end
|