GithubHelp home page GithubHelp logo

Comments (8)

miickel avatar miickel commented on June 23, 2024

Not sure I understand your problem fully. Perhaps you can provide a small example of what you are trying to achieve?

Can't see how this plugin would work differently if you were to use React together with Angular. You can't use relative root urls starting with /? E.g. /some/fancy/template.html

from gulp-angular-templatecache.

willsoto avatar willsoto commented on June 23, 2024

So, in Require (not React), there is a function toUrl() which will automatically generate the path to a given file.

When given a string like require.toUrl('./foo/bar/_baz.html'), require will begin looking for _baz.html starting from the current directory.

This means that the url generated - and the url angular uses in the template cache - begins with ./

The problem I was having with this task is that . and .. are stripped out of the url, meaning angular will never find the template in the cache since it begins with a .

All I need is a hook to prepend something to the url after it has been normalized. My PR adds urlPrefix. I have been using this locally for the last week and it has worked fine.

Does this clarify the issue a bit?

from gulp-angular-templatecache.

miickel avatar miickel commented on June 23, 2024

Thanks for the explanation! This sounds like an edge case to me, so we'll close for now but re-open if more users are requesting something similar. thx

from gulp-angular-templatecache.

TomNeyland avatar TomNeyland commented on June 23, 2024

This sounds like an edge case to me

@miickel Quite the opposite actually.

@Paradox41 is describing a requirejs + angular best-practice. Using require.toUrl gives you all of the benefits of module relative pathing (critical for larger, multi-person projects) while avoiding the headaches involved in using absolute paths.

Refactoring a large project that uses absolute path references for partials is a very special type of hell.

I'd be interested in seeing this reopened, or really any solution that allows continued usage of require.toUrl.

from gulp-angular-templatecache.

TomNeyland avatar TomNeyland commented on June 23, 2024

Also, fwiw, the grunt cousin to this library plays nicely with require.toUrl generated paths.

from gulp-angular-templatecache.

SebastianSchirmer avatar SebastianSchirmer commented on June 23, 2024

I am having the same issue as paradox41.

However not using requirejs but the new angular router.
Need the ./ in the beginning but the join() method removes them.

Therefore requesting reopening this issue.

from gulp-angular-templatecache.

willsoto avatar willsoto commented on June 23, 2024

I have a fork available with my fix that I have been using successfully for
quite some time. Feel free to check it out.

Sent from my Moto X
On May 5, 2015 12:48 PM, "Sebastian Schirmer" [email protected]
wrote:

I am having the same issue as paradox41.

However not using requirejs but the new angular router.
Need the ./ in the beginning but the join() method removes them.

Therefore requesting reopening this issue.


Reply to this email directly or view it on GitHub
#55 (comment)
.

from gulp-angular-templatecache.

SebastianSchirmer avatar SebastianSchirmer commented on June 23, 2024

@Paradox41 Thank you, checked it out and this will work!

@miickel This should be added to this repo as well. By the way, thanks for this great module :-)

from gulp-angular-templatecache.

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.