Giter Site home page Giter Site logo

Comments (15)

whitehat101 avatar whitehat101 commented on August 25, 2024

Yes.

//= require_tree ../templates

For 0.0.7 you will need to rename your files.

 '.html.haml' => '.nghaml'
 '.html.slim' => '.ngslim'

I'm working on a fork that will support '.html.foo'-style filenames and support any markup that Tilt supports. I really like where it is going, but I'm not going to send a PR right away.

from angular-rails-templates.

kimardenmiller avatar kimardenmiller commented on August 25, 2024

Thanks, Jeremy ✅

I'll wait for your new fork I think then and help you test it 😄

from angular-rails-templates.

whitehat101 avatar whitehat101 commented on August 25, 2024

@kimardenmiller I got my fork to a stable place.

https://github.com/whitehat101/angular-rails-templates

I did introduce some non-backwards compatible changes to the gem. I think I mentioned them all in my readme, but here is a quick version:

#Gemfile
gem 'angular-rails-templates', github: 'whitehat101/angular-rails-templates'

# config/environments/development.rb
# add this, restart the webserver, and any change you make to this string will rebuild all your assets
config.assets.version = '1.1'

# app/assets/javascripts/application.js
//= require angular-rails-templates # before you require templates

All assets now need to have .html in their name. .nghaml and .ngslim aren't supported.

index.html
foo.html.haml
bar.html.slim

from angular-rails-templates.

pitr avatar pitr commented on August 25, 2024

@whitehat101 I took a look at the fork, it looks great! Mind opening a pull request?

from angular-rails-templates.

kimardenmiller avatar kimardenmiller commented on August 25, 2024

I plan to take a look as soon as I complete the branch I'm working on in my project. Thanks, @whitehat101 ! :-)

from angular-rails-templates.

pitr avatar pitr commented on August 25, 2024

@whitehat101's changes have been merge and released to 0.1.0. @kimardenmiller, please reopen this ticket if issue persists. Be mindful of small backward-incompatible change that was introduced in #35

from angular-rails-templates.

kimardenmiller avatar kimardenmiller commented on August 25, 2024

@pitr , my app is not quite picking up the caching yet.

Loading the app it seems to not see any cache templates, but also generates some new errors:

image

In my gemfile: gem 'angular-rails-templates', '~> 0.1.1'

In my application.js:

//= require angular-rails-templates
//= require_tree ../templates
//= require ./angular/spokenvote
//= require_tree ./angular

I have both haml and slim templates at the moment:
image

Calling the templates module on bootstrap:

window.App = angular.module('spokenvote', [ 'ngRoute', 'spokenvote.services', 'spokenvote.directives', 'templates', 'ui', 'ui.bootstrap' ]).config(appConfig)

My templates are called the same as they were:

    .when '/landing',
      templateUrl: '/assets/pages/landing.html'

See anything off?

from angular-rails-templates.

pitr avatar pitr commented on August 25, 2024

can you share the template where you have the currentUser.first_name || 'Learn' line?

from angular-rails-templates.

kimardenmiller avatar kimardenmiller commented on August 25, 2024

Sure, that must be this line. 🔗

from angular-rails-templates.

whitehat101 avatar whitehat101 commented on August 25, 2024
.when '/landing',
     templateUrl: '/assets/pages/landing.html'

The templateUrl shouldn't include /assets/.

 .when '/landing',
      templateUrl: 'pages/landing.html'

from angular-rails-templates.

kimardenmiller avatar kimardenmiller commented on August 25, 2024

Trying that path usage puts my Rails server into an endless loop trying to serve assets it can't serve.

FYI, the path I'm using fully works non-caching, and also using $templateCache in a hand-rolled solution I've been using up to now, i.e.:

angular.module('spokenvote.templates', []).run(['$templateCache', ($templateCache) ->
    templates = [
        <% template_cache.each do |template| %>
        path: "<%= template[:path] %>"
        markup: """
                <%= template[:markup] %>
                """
    ,
        <% end %>
    ]

    # Pre-fill the Angular cache
    $templateCache.put(template.path, template.markup) for template in templates
])

My hand-rolled version just does not support .slim, so I was looking to move to this gem.

from angular-rails-templates.

whitehat101 avatar whitehat101 commented on August 25, 2024

@kimardenmiller I cloned you repo and I was able to get the code working. I can get you a more complete "fix" if you need (I'm busy), but...

  1. you have a slim syntax error. slim thinks the {} are trying to include html attributes. if you say b.white() {{ currentUser.first_name || 'Learn' }} that will fix that issue.
  2. your custom templates code is interfering with angular-rails-templates, remove all the register_engine code, and anything that configures Sprockets. or config.assets.path

The default Tilt engines return a mime type. When sprockets renders a foo.html.haml file, it will render the haml and see that is rendered code with a html mime, and stop processing the code. angular-rails-templates has fixed this, but your code overwrites the fix. Remove your custom code. and angular-rails-templates should work like a charm.

I have a working repo on my hdd if you need a PR

from angular-rails-templates.

kimardenmiller avatar kimardenmiller commented on August 25, 2024

@whitehat101 , thanks so much!

Makes perfect sense my templateCache code would have interfered. I removed that and tried to follow along with your other instructions, but mine's not quite working.

Would love to memorialize your commits in our project if you'd like to submit a PR ☕

from angular-rails-templates.

kimardenmiller avatar kimardenmiller commented on August 25, 2024

@whitehat101 , did you say you had a working repo on you hdd? Would love to see it, as I'm still not getting the gem to work 😕. Our main repo is here if you have a PR you are willing to share.

from angular-rails-templates.

whitehat101 avatar whitehat101 commented on August 25, 2024

Yeah, I opened a PR on the repo you mentioned in this issue. I guess I can
look at your upstream repo, too.
On May 10, 2014 11:53 AM, "Kim Miller" [email protected] wrote:

@whitehat101 https://github.com/whitehat101 , did you say you had a
working repo on you hdd? Would love to see it, as I'm still not getting the
gem to work [image: 😕]. Our main repo is herehttps://github.com/railsforcharity/spokenvoteif you have a PR you are willing to share.


Reply to this email directly or view it on GitHubhttps://github.com//issues/34#issuecomment-42750769
.

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.