-
Notifications
You must be signed in to change notification settings - Fork 24
Cannot include assets without a file extension #347
Comments
+1 also, adding .txt as an extension is another workaround. |
any update on this issue? this is affecting us hard as we have many 3rd party git submodules under vendor/assets/javascripts. |
@vollnhals is it still a problem with edge sprockets? |
i am using sprockets-2.8.1 and have this error. there are only two commits on top in master that do not change anything related. |
Nope. |
Why was this closed? Doesn't sound like there was any resolution. |
Why is this a nofix? And what is
supposed to mean? |
For anyone needing a workaround, see the Rakefile addition here: https://gist.github.com/afeld/5704079 |
I'm guessing most people here are running into this problem while using the Rails asset pipeline. The default Rails configuration tells sprockets to compile all files that aren't JS or CSS, and then allows the developer to whitelist specific js and css assets. This is one of the reason your LICENSE files are getting pulled into the compilation phase. I found it was better to remove this setting and replace it with a more specific one that only whitelists the extensions that I want compiled: initializer 'setup_asset_pipeline', :group => :all do |app|
# We don't want the default of everything that isn't js or css, because it pulls too many things in
app.config.assets.precompile.shift
# Explicitly register the extensions we are interested in compiling
app.config.assets.precompile.push(Proc.new do |path|
File.extname(path).in? [
'.html', '.erb', '.haml', # Templates
'.png', '.gif', '.jpg', '.jpeg', # Images
'.eot', '.otf', '.svc', '.woff', '.ttf', # Fonts
]
end)
end |
Nice fix, @wadetandy. |
Perhaps rails should default to |
this is a workaround for sstephenson/sprockets#347
this is a workaround for sstephenson/sprockets#347 Former-commit-id: 422f601
Added extension to license to fix this error: Asset logical path has no extension: font-awesome/LICENSE It appears to be caused by sstephenson/sprockets#347
Extension-less files (e.g. READMEs) will cause Sprockets static compilation (precompilation) to fail. See issue: sstephenson/sprockets#347 Signed-off-by: Alex Coles <[email protected]>
Appears to occur with Rails 3.2.x and Sprockets 2.2.2.backport2. To reproduce: rails _3.2.17_ new sprockets_fail
cd sprockets_fail
echo 'gem "sprockets", "2.2.2.backport2"' >> Gemfile
bundle update sprockets
touch app/assets/javascripts/README
bundle exec rake assets:precompile |
Also reproducible issue with Rails 4.0.x and Sprockets (2.11.0). rails _4.0.3_ new sprockets_fail
touch app/assets/javascripts/README
bundle exec rake assets:precompile This appears to be a regression. Rails 3.2.x with latest supported (non-backported) Sprockets (2.2.2) does not appear to suffer from this issue. |
Replace default Rails configuration Proc with our own that checks against a whitelist of extensions. Poorly-built Bower components often include a number of files not needed at runtime. This solution has the added benefit of keeping non-essential files (.gzip .map .json .md .php .sh .txt) from being served to users. This is an alternative solution to the one found in commit c0d7533 See issue: sstephenson/sprockets#347 Signed-off-by: Alex Coles <[email protected]>
@josh Is the recommendation to rename the assets so they have a file extension or to modify Rails to only precompile assets with specific file extensions, such as: https://gist.github.com/afeld/5704079 or how @myabc did it: opf/openproject@3d7ec71 . I'm not a license person but would some licenses prevent you from renaming a file to add an extension? cc @myabc @DanielHeath I see some people went the route of renaming files or changing rails' default proc, I'm leaning towards the latter... what are your thoughts? |
https://bugzilla.redhat.com/show_bug.cgi?id=1135050 Fixes the issue precompiling assets with sprockets >= 2.4.4: "Asset logical path has no extension: codemirror-4.2/AUTHORS" See the reported upstream issue here[1]. The commit that started this issue is here [2]. This has been an issue in many versions of sprockets since v2.4.4: v2.12.1 v2.12.0 v2.11.1 v2.11.0 v2.10.1 v2.10.0 v2.9.3 v2.9.2 v2.9.1 v2.9.0 v2.8.2 v2.8.1 v2.8.0 v2.7.0 v2.6.0 v2.5.0 v2.4.5 v2.4.4 The solutions found in [1] were to either: a) rename assets to add a file extension (such as AUTHORS -> AUTHORS.txt) b) modify the config.assets.precompile Proc to whitelist which file extensions that were desired or to exclude files without an extension. [1] sstephenson/sprockets#347 [2] sstephenson/sprockets@5dbd7c6
Some licenses require you to send changes upstream; I'd shoot the project owners an email and call it done. In Ruby projects where I hit a bug upstream, I typically write a monkey-patch over the bug.
|
Yes. I mostly don't find Rails' default compile list to be very bower friendly. I have some potential ideas to move away from |
Thanks. I went with the less painful option for now, exclude files without an extension, but it feels like a choice I'll have to revisit as it doesn't feel right. |
+1. Same problem here. I'm monkey-patching my no-extension files :/ |
Sprockets 2.x dies with anything without an extension, READMEs from vendored assets are the most frequent offenders. Fixes sstephenson/sprockets#347.
This is done because of a wontfix bug in Sprockets sstephenson/sprockets#347
This is done because of a wontfix bug in Sprockets sstephenson/sprockets#347
This is done because of a wontfix bug in Sprockets sstephenson/sprockets#347
This is done because of a wontfix bug in Sprockets sstephenson/sprockets#347
+1 Also a problem with OSXs 'Icon\r' files used by Google Drive/Dropbox. See http://superuser.com/questions/298785/icon-file-on-os-x-desktop |
vitalets/angular-xeditable#426 Still a perpetual issue, and really not a fan of having to jump through multiple 'fixes' to resolve this every time it comes up. This needs to be fixed in the base code as a default option, not a configuration flag. |
+1 same here |
Unpacking javascript libraries into vendor/assets results in an error "Asset logical path has no extension" when compiling assets.
This is an issue as many 3rd party javascript libraries include a 'LICENCE' file.
For the moment we can just delete those files each time we upgrade the library but ideally that wouldn't be necessary.
The text was updated successfully, but these errors were encountered: