./lib/lux_assets/base.rb in lux_assets-0.2.21 vs ./lib/lux_assets/base.rb in lux_assets-0.2.23

- old
+ new

@@ -17,23 +17,20 @@ @relative_root = name if name @relative_root end def asset name - @name = name.to_s + @name = name.to_s + @in_bulk = true + @bulk = [] yield end def configure &block class_eval &block end - def bulk name=nil, &block - add_files :js, name, &block - add_files :css, name, &block - end - def js name=nil, &block add_files :js, name, &block end def css name=nil, &block @@ -44,10 +41,12 @@ # add 'plugin:js_widgets/*' # add 'js/vendor/*' # add 'index.coffee' # add proc { ... } def add added + return @bulk.push added if @in_bulk + case added when Array add_local_files added return when Proc @@ -165,12 +164,14 @@ files end def add_files ext, name=nil, &block if block_given? - @files = [] - @ext = ext + @in_bulk = false + @files = [] + @ext = ext class_eval &block + @bulk.map { |it| add it } @files.reject! { |it| it.include?('/!') } @assets[ext][@name] = @files.reject { || } else Asset.new ext, name end \ No newline at end of file