Sha256: f1c2000417f2e2948ba0604c8e1099acae3c4b47a7851b1e419618a5e56891aa
Contents?: true
Size: 972 Bytes
Versions: 9
Compression:
Stored size: 972 Bytes
Contents
require File.expand_path(File.join(File.dirname(__FILE__), "dependency_resolver")) module Juicer module Merger # Resolves @import statements in CSS files and builds a list of all # files, in order. # class CssDependencyResolver < DependencyResolver # Regexp borrowed from similar project: # http://github.com/cgriego/front-end-blender/tree/master/lib/front_end_architect/blender.rb @@import_pattern = /^\s*@import(?: url\(| )(['"]?)([^\?'"\)\s]+)(\?(?:[^'"\)]+)?)?\1\)?(?:[^?;]+)?;?/im private def parse(line, imported_file = nil) return $2 if line =~ @@import_pattern # At first sight of actual CSS rules we abort (TODO: This does not take # into account the fact that rules may be commented out and that more # imports may follow) throw :done if imported_file && line =~ %r{/*} throw :done if line =~ /^[\.\#a-zA-Z\:]/ end end end end
Version data entries
9 entries across 9 versions & 2 rubygems