Sha256: 5eb359f2c488b0a60d27a98ad44228dac4035c0cc092cee82d5ac35515746f89
Contents?: true
Size: 966 Bytes
Versions: 3
Compression:
Stored size: 966 Bytes
Contents
$jsl_import_regex= /\/\*jsl:import\s+([^\*]*)\*\// class JslDependencyFilter < Filter def handles_file(file) return [".js"].include?(file.extension) end def preprocess_content(file, content) content= content.split("\n") line_num=0 content.each { |line| line_num+=1 # handle dependencies line.gsub!($jsl_import_regex) { |match| import_file= File.expand_path(File.join(file.parent_folder, $1)) if (File.exists?(import_file)) file.add_dependency SourceFile.from_path(import_file) else dependency= Project.current.find_file($1) if (dependency) file.add_dependency SourceFile.from_path(import_file) else file.error "Missing import file: #{$1}", line_num end end # replace jsl import with empty string "" } } content.join("\n") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
distil-0.8.4 | lib/filters/jsl-dependency-filter.rb |
distil-0.8.2 | lib/filters/jsl-dependency-filter.rb |
distil-0.8.1 | lib/filters/jsl-dependency-filter.rb |