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

svg compatibility #107

Open
MichaelRFairhurst opened this issue Oct 1, 2014 · 6 comments
Open

svg compatibility #107

MichaelRFairhurst opened this issue Oct 1, 2014 · 6 comments

Comments

@MichaelRFairhurst
Copy link

When trying to use htmlmin with an svg, even with all minification settings turned off

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Your_Icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     viewBox="0 0 612 792" enable-background="new 0 0 612 792" xml:space="preserve">
 ....

was turned into

<!--?xml version="1.0" encoding="utf8"?-->
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Your_Icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     viewBox="0 0 612 792" enable-background="new 0 0 612 792" xml:space="preserve">

Would be nice if (and maybe there is already a workaround for this?) it could detect svgs based on the xml declaration and/or the doctype tag, and either not minify at all or minify with different settings.

@joshuacc
Copy link

joshuacc commented Oct 1, 2014

@MichaelRFairhurst Is that related to this grunt task? Seems like an issue for htmlmin instead.

@MichaelRFairhurst
Copy link
Author

Its probably more related to htmlmin...but in some ways, the bug is that its sent into htmlmin in the first place, instead of svgmin or something. I don't think the htmlmin plugin usually has any reason to face off against an svg, and the fact that an svg was sent in at all could be considered the bug. Is there a workaround to accomplish this?

@joshuacc
Copy link

joshuacc commented Oct 1, 2014

@MichaelRFairhurst What does your grunt config look like? You can exclude SVGs there.

@MichaelRFairhurst
Copy link
Author

    ngtemplates: {
        app: {
            src: ['public/angular/**/*.html', 'public/svg/**/*.svg'],
            dest: 'public/templates.js',
            options: {
                prefix: '/',
                module: 'pAngularApp',
                htmlmin: {
                    collapseBooleanAttributes:      false, // SVG

compatibility
collapseWhitespace: false,
removeAttributeQuotes: false, // SVG
compatibility
removeComments: false, // Only if
you don't use comment directives!
removeEmptyAttributes: false,
removeRedundantAttributes: false,
removeScriptTypeAttributes: false,
removeStyleLinkTypeAttributes: false
}
}
}
}

This is the configuration that doesn't work. I have to comment out the
htmlmin property directly. And to clarify, I definitely want my svgs
precached, we very commonly do ng-includes with svgs.

On Wed, Oct 1, 2014 at 1:39 PM, Joshua Clanton [email protected]
wrote:

@MichaelRFairhurst https://github.com/MichaelRFairhurst What does your
grunt config look like? You can exclude SVGs there.


Reply to this email directly or view it on GitHub
#107 (comment)
.

@joshuacc
Copy link

joshuacc commented Oct 1, 2014

@MichaelRFairhurst Could you create two subtasks for ngtemplates?

One for HTML that includes htmlmin config, and a second for svg that excludes htmlmin. Then concat the two JS files.

May not be the ideal solution, but it should work.

@MichaelRFairhurst
Copy link
Author

That will work just fine, thanks!

On Wed, Oct 1, 2014 at 2:10 PM, Joshua Clanton [email protected]
wrote:

@MichaelRFairhurst https://github.com/MichaelRFairhurst Could you
create two subtasks for ngtemplates?

One for HTML that includes htmlmin config, and a second for svg that
excludes htmlmin. Then concat the two JS files.

May not be the ideal solution, but it should work.


Reply to this email directly or view it on GitHub
#107 (comment)
.

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

No branches or pull requests

2 participants