This repository has been archived by the owner on Aug 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
SVG inlining #56
Merged
Merged
SVG inlining #56
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
33cd656
don't use version as an arg with grunt
jrit 1154459
Merge branch 'master' of https://github.com/vokal/dominatr-grunt
jrit a91005b
update dep grunt-aws to vokal fork
jrit 16f0831
SVG inlining
jrit 5ddfa0b
inline svgs in the index
jrit 9ea96a6
document SVG inline
jrit c4cfade
update `other bits`
jrit 23d3c34
rename sprite task, which was misleading, and inline SVG in templates
jrit 7f94333
fix templates watch
jrit d663a3a
merge from vokal
jrit 7c3d40b
svg_inline documentation
jrit b810f95
doc
jrit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"use strict"; | ||
|
||
var inline = require( "web-resource-inliner" ); | ||
var a = require( "async" ); | ||
|
||
module.exports = function ( grunt ) | ||
{ | ||
grunt.registerTask( "svg_inline", "Inline SVG use", function () | ||
{ | ||
var done = this.async(); | ||
var src = [ | ||
"modules/*/templates/*.html", | ||
"!modules/_app/templates/index.html" | ||
]; | ||
|
||
var tasks = | ||
grunt.file.expandMapping( src, ".inlined", { cwd: "source" } ) | ||
.map( function ( file ) | ||
{ | ||
return function ( done ) | ||
{ | ||
var fileContent = grunt.file.read( file.src ); | ||
|
||
inline.html( { | ||
fileContent: fileContent, | ||
images: false, | ||
scripts: false, | ||
links: false, | ||
relativeTo: "build/" | ||
}, function ( err, res ) | ||
{ | ||
if( err ) | ||
{ | ||
return done( err ); | ||
} | ||
grunt.file.write( file.dest, res ); | ||
done(); | ||
} ); | ||
}; | ||
} ); | ||
|
||
a.series( tasks, function ( err ) | ||
{ | ||
if( err ) | ||
{ | ||
grunt.fail.warn( err, err.stack ); | ||
} | ||
done(); | ||
} ); | ||
} ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "dominatr-grunt", | ||
"version": "6.1.2", | ||
"version": "7.0.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What makes this a breaking change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It changes the default behavior of all SVG elements. To have it be a minor the default behavior should stay the same IMO. |
||
"description": "Build all the things!", | ||
"scripts": { | ||
"test": "" | ||
|
@@ -50,12 +50,14 @@ | |
"protractor": "^2.5.1" | ||
}, | ||
"dependencies": { | ||
"async": "^2.0.0-rc.2", | ||
"autoprefixer": "^6.1.1", | ||
"aws-sdk": "^2.2.25", | ||
"babel-preset-es2015": "^6.3.13", | ||
"connect-modrewrite": "^0.8.2", | ||
"cssnano": "^3.3.2", | ||
"serve-static": "^1.10.0", | ||
"slack-node": "^0.1.7" | ||
"slack-node": "^0.1.7", | ||
"web-resource-inliner": "^2.0.0" | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
tobuild
in the copy task, including it here would still lead to it being overwritten when running a buildThere 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.