Comments (17)
Same problem here
from angular-rails-templates.
It's very likely to be a config.assets.precompile
setting. Add this to application.rb
:
config.assets.precompile += [
'*.html',
'*/*.html'
]
from angular-rails-templates.
@pitr I tried this and it just copied them over to public/assets/templates
as .html.haml
files
from angular-rails-templates.
can you try requiring a specific template? For example, if you have a app/assets/templates/some/file.html
, add //= require some/file
to application.js.
from angular-rails-templates.
rake aborted!
./templates/roadmap_choices.html is 'text/html', not 'application/javascript'
I also tried it without the file extension and it couldn't find the file.
from angular-rails-templates.
Try changing config.assets.version
in config/environments
(or config/application.rb
). That will force sprockets to invalidate it's cache and rebuild all assets.
(undo changes to config.assets.precompile and your javascript manifest)
I just tested it against a new 3.2.16
app. Everything seems to work without any configuration. I can publish it if people are interested -- but all I did was rails new, add the gem to the Gemfile, and create a template in app/assets/javascripts/templates/plain.html.
Could you share your Gemfile.lock file?
from angular-rails-templates.
I created a git repo of my test app: https://github.com/whitehat101/art-rails-3.2.16-test
from angular-rails-templates.
Same problem here, any template .html file is just ignored and is not injected in the application.js
from angular-rails-templates.
@divins can you create a dummy app that exhibits this issue. Neither I nor @whitehat101 were able to replicate.
from angular-rails-templates.
Hi guys!
I had similar problem to this, what @elyngved described. After long debugging session, I discovered, the app needs to be initialised on precompiling... be aware of that. Otherwise, the angular-rails-templates
initialiser isn't called, and this isn't registered:
app.assets.register_engine '.html', AngularRailsTemplates::Template
Cheers
from angular-rails-templates.
@simon2k +1 Thanks
from angular-rails-templates.
Same problem here. I tried the above solution but none worked.
I also get the feeling that AngularRailsTemplates is not initialize. I cannot see any trace of it.
By the way I'm using .html.slim templates.
Any suggestion on how to debug? @simon2k
from angular-rails-templates.
I solved this problem using:
# config/application.rb
# ....................
config.before_initialize do |app|
require 'sprockets'
require 'angular-rails-templates'
Sprockets::Engines #force autoloading
Sprockets.register_engine '.html', AngularRailsTemplates::Template
end
@diegodurs Try this:
# config/application.rb
# ......
config.before_initialize do |app|
require 'sprockets'
require 'tilt'
require 'angular-rails-templates'
mimeless_slim = Class.new(Tilt[:slim]) do
def self.default_mime_type
nil
end
end
Sprockets::Engines #force autoloading
Sprockets.register_engine '.slim', mimeless_slim
Sprockets.register_engine '.html', AngularRailsTemplates::Template
end
from angular-rails-templates.
Hey! Thanks for all the snooping!
Could someone summarize this for me? I'd like to make changes and annotate why they are needed. I wasn't able to actually reproduce this issue.
I think I read...
- Rails 3.2 works if initialize_on_precompile is true
- Otherwise, Rails 3.2 needs ART to be run in
before_initialize
(like it was a few patch versions back) instead of regularinitializer
. - Does
app.assets.register_engine
also need to be replaced with direct calls toSprockets.register_engine
?
We made the switch from before_initialize
to initializer
because the slim-rails
gem (not to be confused with the slim
gem) was mangling some of our configuration.
from angular-rails-templates.
I'm experiencing this issue too. And fix from @hpetru doesn't work for me. I'm using *.html.haml and with fix from @hpetru raw HAML is served and not compiled HTML.
I fixed this with downgrading angular-rails-template to version 0.1.2.
from angular-rails-templates.
Any updates on how to solve this issue?
from angular-rails-templates.
closing old issue
from angular-rails-templates.
Related Issues (20)
- Uncaught SyntaxError: Unexpected token < HOT 2
- How to specify config if I am using templates inside a mountable engine (namespace isolated) HOT 3
- Extension `.html` should not be necessary anymore HOT 1
- Deprecation warning from sprockets 3.7.0 HOT 6
- Rails functions in .erb templates for angular HOT 1
- Having issues with 'angular-cookie' loading HOT 1
- NoMethodError: undefined method `bytesize' for nil:NilClass HOT 3
- Failed to load template HOT 2
- Docs: templates location
- Does this gem work with Angular 2 and Rails 5? HOT 1
- How to use Devise helper on template? HOT 2
- How to show image in angular template with .html extention HOT 2
- I got empty page in production mode HOT 3
- Rails 5.1 compatibility? HOT 10
- Empty page when deploying to sub-uri
- instance variable
- inline_svg with RAILS_ENV=production HOT 1
- Rails 6 compatibility HOT 4
- Looking for a new maintainer? HOT 1
- Support for Rails 7.1? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-rails-templates.