Comments (6)
You would want to take a look at the include
option in the build file. It can help you add specific dependencies to be optimized.
from knockout-amd-helpers.
I tried that, and it was successfully included in the packaged file, but nevertheless your plugin downloaded it again ;) My guess would be somehow different paths or something like that, but I couldn't see from the library source how exactly the path has to be to be identical. Could that be the reason?
from knockout-amd-helpers.
@nmehlei could be. Can you post some details about your build file and structure? I committed an optimized build of the little example in this repository.
One thing that could be happening to you is that your ko.applyBindings
call could be happening before your templates are defined in the optimized output. As a test, you can try calling ko.applyBindings
in a setTimeout 0
. When I optimized the example, I noticed that this was happening at first to my top-level templates.
from knockout-amd-helpers.
Thanks, that worked for me and it did not redownload the file.
It doesn't seem, however, that there's a way to automatically include all the template files. I see in the example that each template file is explicitly set. I see why, however, since the dependency is a dynamic require call - there's no way for the optimizer to really know beforehand.
from knockout-amd-helpers.
Sorry @rniemeyer, forgot to answer, but everything worked fine after I corrected the paths in the build file for r.js (in my case 'text!../../Content/Templates/bla..', the ../ were necessary and I didn't see that at first).
@Badunk you're right, there is no wildcard support. but I think you could use the power of nodejs to include a small script in your r.js build file that traverses your directories, builds a list and uses that...I think I read that somewhere.
from knockout-amd-helpers.
@Badunk @nmehlei - as far as dynamic dependencies, you can take a look at this article that I wrote that describes a grunt task to help. Should be possible to write something for other build systems as well.
from knockout-amd-helpers.
Related Issues (20)
- AfterRender not firing when module is initialized with a null observable HOT 2
- Getting the reference to the bound element HOT 10
- module and template loaders don't work with require.config moduleIDs packages HOT 12
- API available in bonded module needs to be called after template finishes rendering HOT 2
- Working with Typescript AMD Modules HOT 2
- [Request] Option to require additional files by convention HOT 1
- Provide simple way to load external templates from within custom bindings HOT 1
- afterRender still fires only for the first template when using external templates with requirejs/text HOT 2
- publish NuGet package for v.0.7.3 HOT 1
- Module Binding: require() for the template source should not have to wait until the module is downloaded
- Passing data from Tempate to Module HOT 2
- template binding with 'with' doesn't work HOT 4
- beforeRemove callback is not firing for template binding HOT 5
- Ready to use KO module using requirejs "map" HOT 2
- Passing markup into modules HOT 14
- Knockout-amd-helpers does not play well with r.js namespacing HOT 3
- renderTemplateSource produces an empty string HOT 3
- Dynamically assigning a template path in renderTemplate() HOT 2
- not working with webpack very well. HOT 2
- knockout-amd-helpers need new typings
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 knockout-amd-helpers.