Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partials loading through RequireJS #16

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Aintaer
Copy link

@Aintaer Aintaer commented Jan 27, 2014

Allows autoloading of partials by recursively using RequireJS

  • Absolute partial paths {{> /path/to/partial}}
  • Relative (to current template) partial paths {{> ./siblingPartial}}
  • pathPrefix for default partial path lookups, e.g. pathPrefix: 'templates'
    • {{> lib/sharedPartial}} => templates/lib/sharedPartial.mustache

Any partials that have the delimiter character will be considered a
requirement for the module and pulled in through require()
Partial names can now be module path names

- Absolute paths: /path/to/module
- Relative to current module: ../to/future
- Prefixed names when given a prefixPath config
  - path/to/module -> prefixPath/path/to/module
It is important to use the plugin-local version of require so as not to
be subject to contexts of the global.
The build path was previously broken as any require() calls will
invariably return undefined during build. This and a shadowed name
caused the build map to be empty. This now builds correctly.
@Aintaer Aintaer mentioned this pull request Jan 27, 2014
Aintaer and others added 3 commits January 27, 2014 19:36
The delimiter should prevent the partial name from being registered as
something to resolve.
Instead of return a custom render function, use a custom template.ri
function. This allows partials to have their own requirements bound to
them.
@j-5-s
Copy link

j-5-s commented Apr 6, 2016

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants