Sha256: d33b2c74cee070427d650077312074867961c489c9d6f2c1e28c311f823d2ee3
Contents?: true
Size: 1.38 KB
Versions: 5
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true require 'epuber-stylus' module Epuber class Compiler module FileTypes require_relative 'css_file' class StylusFile < CSSFile # @param [Compiler::CompilationContext] compilation_context # def process(compilation_context) if destination_file_up_to_date? # HACK: for now, we need to process the file again, because we need to find linked files process_css(File.read(final_destination_path), compilation_context) return end 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) css = Stylus.compile(File.new(abs_source_path)) write_compiled(process_css(css, compilation_context)) 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
5 entries across 5 versions & 1 rubygems