Module: Wesc
- Defined in:
- lib/wesc.rb,
lib/wesc/version.rb
Defined Under Namespace
Classes: Result
Constant Summary collapse
- VERSION =
"0.7.0"
Class Method Summary collapse
-
.build(input, outcss: nil, outjs: nil, minify: false) ⇒ Wesc::Result
Build the entry points and return a Result.
-
.build_stream(input, outcss: nil, outjs: nil, minify: false) {|chunk| ... } ⇒ void
Stream the build to a block, chunk by chunk, for low-memory output.
Class Method Details
.build(input, outcss: nil, outjs: nil, minify: false) ⇒ Wesc::Result
51 52 53 54 |
# File 'lib/wesc.rb', line 51 def build(input, outcss: nil, outjs: nil, minify: false) html, css, js = Native.build(Array(input), outcss, outjs, minify ? true : false) Result.new(html, css, js) end |
.build_stream(input, outcss: nil, outjs: nil, minify: false) {|chunk| ... } ⇒ void
This method returns an undefined value.
Stream the build to a block, chunk by chunk, for low-memory output.
The block is called with each chunk as a String, then once with ‘nil` to signal the end of the stream. Raising from the block stops the build and the exception propagates out of this method.
Wesc.build_stream(["./index.html"]) do |chunk|
io.write(chunk) unless chunk.nil?
end
73 74 75 76 77 |
# File 'lib/wesc.rb', line 73 def build_stream(input, outcss: nil, outjs: nil, minify: false, &block) raise ArgumentError, "Wesc.build_stream requires a block" unless block Native.build_stream(Array(input), outcss, outjs, minify ? true : false, &block) end |