rstacruz / sinatra-assetpack

Package your assets transparently in Sinatra.
http://ricostacruz.com/sinatra-assetpack/
MIT License
542 stars 96 forks source link

precompile:build creates copies for blobs existing in defined 'serve' paths? #182

Closed Rendez closed 10 years ago

Rendez commented 10 years ago

HI, is there a better way to build? Here's my set-up:

assets {
      serve '/javascripts',           from: 'assets/javascripts'
      serve '/stylesheets',           from: 'assets/stylesheets'
      serve '/images',                from: 'assets/images'
      serve '/vendor',                from: '../vendor/bower_components/'
      serve '/bootstrap/javascripts', from: '../vendor/bower_components/bootstrap-sass-official/assets/javascripts/bootstrap'

      js :application, [
        '/bootstrap/javascripts/carousel.js',
        '/bootstrap/javascripts/collapse.js',
        '/bootstrap/javascripts/dropdown.js',
        '/bootstrap/javascripts/transition.js',
        '/bootstrap/javascripts/tooltip.js',
        '/javascripts/hideaddrbar.js',
        '/javascripts/jquery.bootstrap-autohidingnavbar.js',
        '/javascripts/application.js'
      ]
      css :application, ['/stylesheets/application.css']
      css :coderay,     ['/stylesheets/coderay.css']

      js_compression  :uglify, [mangle: false]
      css_compression :sass

      expires 86400*30
    }

And here´s the build! method:

      def build!(&blk)
        packages.each { |_, pack| build_package!(pack, &blk) }
        files.each { |path, local| build_file!(path, local, &blk) }
      end

I was not expecting the build task to create folders for all my vendor files. I would like to build packages, and leave files out, and I´m aware this was separated in previous releases. But what if I only want to build image files. Or better, how can I create packages without necessarily "serve" clauses included?

I don´t see how polluting the public dir with stylesheets javascripts images bower_components md5 versions of all files is necessarily good.