dennismonsewicz
dennismonsewicz

Reputation: 25542

Rails asset pipeline strips out plugin copyrights

I have some vendor files in my application that contain copyright information that needs to be visible if someone were to look at the source file. But when asset pipeline runs, it strips all of that out. Is there anyway to not remove the copyright information?

Upvotes: 2

Views: 65

Answers (2)

Maxim
Maxim

Reputation: 9981

You should specify uglifier option to leave copyright comments.

Replace config.assets.js_compressor in your production.rb to this:

if defined? Uglifier
  config.assets.js_compressor = Uglifier.new(
    output: {
      comments: :copyright
    }
  )
end

Here you can find list of all uglifier options.

P.S. Don't forget to remove precompiled assets before precompile them again with new options.

Upvotes: 3

NM Pennypacker
NM Pennypacker

Reputation: 6942

Assuming you're putting all the copyright info in a comment, no. Precompiling the assets minimizes your Javascript and CSS, which strips out comments.

Upvotes: 0

Related Questions