Giter Site home page Giter Site logo

Comments (17)

foxyblocks avatar foxyblocks commented on July 23, 2024

Same problem here

from angular-rails-templates.

pitr avatar pitr commented on July 23, 2024

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.

foxyblocks avatar foxyblocks commented on July 23, 2024

@pitr I tried this and it just copied them over to public/assets/templates as .html.haml files

from angular-rails-templates.

pitr avatar pitr commented on July 23, 2024

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.

foxyblocks avatar foxyblocks commented on July 23, 2024
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.

whitehat101 avatar whitehat101 commented on July 23, 2024

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.

whitehat101 avatar whitehat101 commented on July 23, 2024

I created a git repo of my test app: https://github.com/whitehat101/art-rails-3.2.16-test

from angular-rails-templates.

divins avatar divins commented on July 23, 2024

Same problem here, any template .html file is just ignored and is not injected in the application.js

from angular-rails-templates.

pitr avatar pitr commented on July 23, 2024

@divins can you create a dummy app that exhibits this issue. Neither I nor @whitehat101 were able to replicate.

from angular-rails-templates.

simon2k avatar simon2k commented on July 23, 2024

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.

hpetru avatar hpetru commented on July 23, 2024

@simon2k +1 Thanks

from angular-rails-templates.

diegodurs avatar diegodurs commented on July 23, 2024

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.

hpetru avatar hpetru commented on July 23, 2024

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.

whitehat101 avatar whitehat101 commented on July 23, 2024

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 regular initializer.
  • Does app.assets.register_engine also need to be replaced with direct calls to Sprockets.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.

palodelincak avatar palodelincak commented on July 23, 2024

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.

anhkind avatar anhkind commented on July 23, 2024

Any updates on how to solve this issue?

from angular-rails-templates.

pitr avatar pitr commented on July 23, 2024

closing old issue

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.