Sha256: ba796abd4e742651e12626cb0cb092500152acd3b6e8ec8a65d6027cdfca9132
Contents?: true
Size: 1.12 KB
Versions: 15
Compression:
Stored size: 1.12 KB
Contents
# encoding: utf-8 require 'epuber-stylus' module Epuber class Compiler module FileTypes require_relative 'source_file' class StylusFile < SourceFile # @param [Compiler::CompilationContext] compilation_context # def process(compilation_context) return if destination_file_up_to_date? Stylus.define('__is_debug', !compilation_context.release_build) Stylus.define('__is_verbose_mode', compilation_context.verbose?) Stylus.define('__target_name', compilation_context.target.name) Stylus.define('__book_title', compilation_context.book.title) Stylus.define('__const', compilation_context.target.constants) write_compiled(Stylus.compile(File.new(abs_source_path))) update_metadata! end def find_dependencies self.class.find_imports(File.read(abs_source_path)) end # @return [Array<String>] # def self.find_imports(content) content.to_enum(:scan, /^\s*@import ("|')([^'"]*)("|')/).map { Regexp.last_match[2] } end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems