You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
currently react-templates relies on lodash for doing some core functions (looping etc..) but such "helper" functions could be loaded as external dependency module instead of being "embedded" in the render function.
If so, it would be possible to fine tune and possibly avoid the direct dependency from lodash.
In PR #176 I've isolated the 4 "helper functions" actually used by react-templates:
__rtmap(collection, function); // loops over a collection
__rtclass(object); // turns a map object into a HTML class-attribute
__rtassign(dest,...objs) // assign properties to destination object
__rtmergeprops(dest,...objs) // as above, but considering "style" and "className"
They can be "enabled" with the new CLI option --external-helpers modulename.
I've also written a plain vanilla helper-functions module called react-templates-helpers that falls back on lodash.
As a bonus, since the helper functions are loaded separately one by one, in future it will be possible to take advantage of ES6 tree shaking features (rollupjs, webpack etc...).
Another small advantage is that now lodash is loaded only when needed, that is, if the component is small enough and doesn't use any of the helpers, lodash is left out because not needed.
The text was updated successfully, but these errors were encountered:
currently
react-templates
relies onlodash
for doing some core functions (looping etc..) but such "helper" functions could be loaded as external dependency module instead of being "embedded" in the render function.If so, it would be possible to fine tune and possibly avoid the direct dependency from
lodash
.In PR #176 I've isolated the 4 "helper functions" actually used by
react-templates
:They can be "enabled" with the new CLI option
--external-helpers modulename
.I've also written a plain vanilla helper-functions module called react-templates-helpers that falls back on
lodash
.As a bonus, since the helper functions are loaded separately one by one, in future it will be possible to take advantage of ES6 tree shaking features (rollupjs, webpack etc...).
Another small advantage is that now
lodash
is loaded only when needed, that is, if the component is small enough and doesn't use any of the helpers,lodash
is left out because not needed.The text was updated successfully, but these errors were encountered: