Class: Brandish::Processors::HTML::Script

Inherits:
Common::Asset show all
Includes:
Babel, Coffee, Vanilla
Defined in:
lib/brandish/processors/html/script.rb,
lib/brandish/processors/html/script/babel.rb,
lib/brandish/processors/html/script/coffee.rb,
lib/brandish/processors/html/script/vanilla.rb

Overview

A script asset. This is a JavaScript asset.

Engines:

  • "babel", "babel-file" - A command. This takes the contents of the resolved file, transpiles it, and outputs it into the output path, given by #load_file_paths.
  • "babel-inline" - A block. Similar to "babel"; however, it takes the block, uses Brandish::Parser::Node::Root#flatten on it, transpiles the result, and adds that as an inline script.
  • "coffee", "coffee-file" - A command. This takes the contents of the resolved file, transpiles it, and outputs it into the output path, given by #load_file_paths.
  • "coffee-inline" - A block. Similar to "coffee"; however, it takes the block, uses Brandish::Parser::Node::Root#flatten on it, transpiles the result, and adds that as an inline script.
  • "file" - A command. Takes a file, and copies it over to the destination, based on the values given in #load_file_paths.
  • "remote", "remote-file" - A command. Takes a URI (supports http, https, and ftp), and outputs the directory into the "output" pair (or a uri path assumed from the URI).
  • "inline" - A block. This performs Brandish::Parser::Node::Root#flatten on the body, and pushes the result as an inline style.
  • "remote-inline" - A command. Similar to "remote"; however, this takes the remote styles as an inline style.

Pairs:

  • "src", "file", "name", or "link" - Required. At least one of these options are required. They all perform the same function. This defines the name or path of the asset to add or process.
  • "type" - Required. The type of the asset to process. This defines how the asset is handled.

Defined Under Namespace

Modules: Babel, Coffee, Vanilla

Instance Attribute Summary

Attributes inherited from Brandish::Processor::Base

#context

Instance Method Summary collapse

Methods inherited from Common::Asset

engine, engines, #load_asset_file, #perform

Methods included from Common::Asset::Paths

#asset_load_paths, #load_file_paths, #output_assets_path, #uri_path

Methods included from Brandish::Processor::Block

included, #perform, #process_block

Methods included from Brandish::Processor::Command

included, #perform, #process_command

Methods inherited from Brandish::Processor::Base

#accept, #call, #initialize, #postprocess, #process_block, #process_command, #process_root, #process_text, register, #setup

Constructor Details

This class inherits a constructor from Brandish::Processor::Base

Instance Method Details

#asset_kind_extension::String

This method is abstract.

The extension for this kind of asset. This defaults to no extension.

Returns:

  • (::String)


58
59
60
# File 'lib/brandish/processors/html/script.rb', line 58

def asset_kind_extension
  ".js"
end

#asset_kind_path::String

This method is abstract.

The asset path for this kind of asset.

Returns:

  • (::String)


53
54
55
# File 'lib/brandish/processors/html/script.rb', line 53

def asset_kind_path
  "assets/scripts"
end