Comments (5)
If you have been fiddling with the ignore prefix, then that might explain this behavior. Rails will cache templates after it renders them. If the source file doesn't change, then the template won't get recompiled if you change the ignore_prefix
until the source template gets modified.
Try setting:
# config/environments/development.rb (and production.rb if you deployed)
config.assets.version = "something new"
Or nuking your tmp/
directory.
I set my assets.version
to "#{Time.now}"
when I was doing heavy development on this project. It invalidated all the cached assets every time I booted rails server
.
from angular-rails-templates.
@whitehat101 that indeed seems to fix it.
Any way to prevent this happening? Seems like an hack to use assets.version
from angular-rails-templates.
I bet this is the same root cause as issue #37.
It's what asset.version
if for, but having the user have to know about it is unexpected. It should probably be documented or...
sprockets-rails does this source:
# Configuration options that should invalidate
# the Sprockets cache when changed.
app.assets.version = [
app.assets.version,
config.assets.version,
config.action_controller.relative_url_root,
(config.action_controller.asset_host unless config.action_controller.asset_host.respond_to?(:call)),
Sprockets::Rails::VERSION
].compact.join('-')
Since the length of the app.assets.version
string doesn't seem to matter, I bet we could append ignore_prefix
to config.assets.version
so that the user never has to manually change the asset version because he or she changed a-r-t's config.
I don't know what the difference is between app
and config
.assets.version
. I bet it's a Rails 3/4 thing.
We'd have to check the versions of sprockets
and sprockets-rails
that rails 3 and rails 4 pull.
from angular-rails-templates.
Since I realized I could put templates in app/assets/templates
(instead of app/assets/javascripts/templates
) ignore_prefix
became kinda useless to me. Neither the asset path nor the angular name contain templates
, so they are both night and tight.
I'm a little concerned about collisions e.g.:
file | asset path | angular name |
---|---|---|
app/assets/templates/modal.html.haml | /assets/modal.js | modal.html |
app/assets/javascripts/modal.js.coffee | /assets/modal.js |
But since I keep my directives in javascripts/directives
, collisions just won't happen. I know not to name a template the same name as a top-level js asset. For my angular projects, that typically only means I can't name a template app
or application
.
from angular-rails-templates.
thanks @whitehat101 PR merged, v0.1.2 is out
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.