Comments (15)
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.
Thanks, Jeremy ✅
I'll wait for your new fork I think then and help you test it 😄
from angular-rails-templates.
@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.
@whitehat101 I took a look at the fork, it looks great! Mind opening a pull request?
from angular-rails-templates.
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.
@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.
@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:
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:
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.
can you share the template where you have the currentUser.first_name || 'Learn'
line?
from angular-rails-templates.
Sure, that must be this line. 🔗
from angular-rails-templates.
.when '/landing', templateUrl: '/assets/pages/landing.html'
The templateUrl
shouldn't include /assets/
.
.when '/landing',
templateUrl: 'pages/landing.html'
from angular-rails-templates.
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.
@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...
- you have a slim syntax error. slim thinks the
{}
are trying to include html attributes. if you sayb.white() {{ currentUser.first_name || 'Learn' }}
that will fix that issue. - your custom templates code is interfering with angular-rails-templates, remove all the
register_engine
code, and anything that configuresSprockets
. orconfig.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.
@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.
@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.
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)
- 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.