Giter Site home page Giter Site logo

Comments (5)

whitehat101 avatar whitehat101 commented on July 23, 2024

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.

GriffinHeart avatar GriffinHeart commented on July 23, 2024

@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.

whitehat101 avatar whitehat101 commented on July 23, 2024

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.

whitehat101 avatar whitehat101 commented on July 23, 2024

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.

pitr avatar pitr commented on July 23, 2024

thanks @whitehat101 PR merged, v0.1.2 is out

from angular-rails-templates.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.