Skip to content

Conversation

tsufiev
Copy link

@tsufiev tsufiev commented Apr 26, 2018

  • introduce a new option 'templateName' which can contain all
    interpolations to be used in interpolateName (see
    https://www.npmjs.com/package/loader-utils#interpolatename )
  • pass all options directly to interpolateName, so that 'regExp'
    option could be used as well (see examples in above link).

* introduce a new option 'templateName' which can contain all
  interpolations to be used in `interpolateName` (see
  https://www.npmjs.com/package/loader-utils#interpolatename )
* pass all options directly to `interpolateName`, so that 'regExp'
  option could be used as well (see examples in above link).
Copy link
Contributor

@chadly chadly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I wasn't aware of those options on interpolateName. Could you update the documentation (the README) as well to show some examples of how this could be used?

@tsufiev
Copy link
Author

tsufiev commented Apr 27, 2018

Hi! It turned out that for my purposes being just able to have a precise control over template name/id is not enough. Since there is a lot of templates in my project, and most of them are small reusable snippets not required directly from js code, I have 2 options when using webpack to deal with them:

  • require all templates in a single js file (that's what I'm doing now, but I regard this approach as a temporary one)
  • require only 'roots' of the template trees in corresponding js files, and then require the rest (mostly small reusable snippets) recursively along the way, in the template loader.

I'd prefer to use the 2nd approach - so I'm going to push a couple more commits, once I figure out how to implement the recursive template sourcing :/.

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