-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
var done = this.async(); | ||
var src = [ | ||
"modules/*/templates/*.html", | ||
"!modules/_app/templates/index.html" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not the index file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the index file is moved from source
to build
in the copy task, including it here would still lead to it being overwritten when running a build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be run after copy
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make adjustments as needed for index, it shouldn't be too complicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. Something to consider is that ngtemplates also ignores the index file, so that would need to change as well. Either that or copy references the .inlined
index file now.
index should work now |
No documentation added to the README. I'm not sure I'm really for this on a global level. Has this been considered as an optional plugin for ngtemplates or as a separate task in maybe the packaging step? |
ngtemplates can only use transforms that are synchronous but web-resource-inliner is only async, so I had to set it up as a separate task. Is there a reason you don't think this is a good idea? |
I do think it's maybe a little weird to have the copy step hard-reference the index file in the "inlined svg files" directory, regardless of whether your project even includes svgs. |
@jrit I really think this should at best be included as part of the "package" step. It's an optimization for svgs that we won't use in all projects. I agree with @Tathanen on referencing a temporary directory for the copy task just feels weird. I'm assuming that it's not possible to run this after |
that is correct that after ngtemplates runs it is all JS strings and impossible to do anything useful with.
we are already running other SVG steps, this is an extension of those which are also global - I think removing the step would be optimizing for no real reason, the additional build time is neglibile
ngtemplates is the same, and both have always had hard-coded paths in them, I'm not really sure how this is any worse now that the path is just in a different file |
It's not really the hard-coding that's weird to me, it's "pull from the SVG folder" when my site might not have SVGs in it at all, just a buncha weird SVG stuff in here running all the time with no effect. It's largely a pedantic concern though, it seems to be perfectly functional as-is. |
Yeah, it is possible that there is no effect. As an outcome of having a convention-based project setup that doesn't require much configuration on each project, there may be tasks that don't cause any changes. The alternative would be having more configuration at the project level, but we've generally been trying to avoid that. So ¯_(ツ)_/¯ |
Added new task to the readme. |
thanks @dmaloneycalu - updated |
I think the If I'm mistaken let me know, but |
It should be both now. When SVGs change, inline and build templates. When templates change, inline and build templates, so the end result is always the same. |
@@ -16,7 +16,7 @@ module.exports = { | |||
templates: { | |||
options: { cwd: "<%= ngtemplates.build.cwd %>" }, | |||
files: "<%= ngtemplates.build.src %>", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines here need changed, otherwise saving a template file doesn't do anything. They should reference svg_inline
's cwd
, and src
Finally got around the working against this again and this seems to be working properly now. |
Needs a changelog update. After that I'm not seeing anything missing. Have @Tathanen confirm though. My vote is that this is still more of a feature change than a breaking change but that may be the outlier opinion for us. |
LGTM after changelog update, yeah. I could maybe make an argument for a bit more elaboration in the |
updated the docs, look good? |
Inline joke, LBTM. Add "[Breaking Changes]" after the version number in the changelog like with all the other majors, then should be good to go. |
@vokal/web this defaults the build to inline SVGs if they are less than 8KB. You can disable this per SVG if you want by using the attribute
data-inline-ignore
which is documented here https://www.npmjs.com/package/web-resource-inlinerThis only affects SVG
<use>
so if you are using<img>
or already have SVGs embedded nothing will change. This actually fixes SVG support on IE up through 11 without using a JS polyfill, I was doing that and ran into a number of problems. This is also more inline with what GitHub is doing for SVGs as described here https://github.com/blog/2112-delivering-octicons-with-svgThe new grunt task could possibly be pulled into its own module later.
Fixes #51