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
create an svg icon sprite for all action icons #3385
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ec1fcae
create an svg icon sprite for all action icons
ChristophWurst 07a738c
fix icons in files app
ChristophWurst 75d82d8
add makefile
ChristophWurst dab25c5
add spacing around individual svgs
ChristophWurst d344991
fix delete icon hover state
ChristophWurst 6ab7188
fix header carets
ChristophWurst 8f3e5f7
Do not overwrite icon's min width/height
ChristophWurst File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This file is licensed under the Affero General Public License version 3 or | ||
# later. See the COPYING file. | ||
# @author Christoph Wurst <christoph@winzerhof-wurst.at> | ||
# @copyright Christoph Wurst 2017 | ||
|
||
default: svg-sprites | ||
|
||
svg-sprites: clean | ||
cd build && \ | ||
npm install && \ | ||
pwd && \ | ||
grunt | ||
|
||
clean: | ||
rm -f core/css/images/actions-*.svg |
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,52 @@ | ||
module.exports = function (grunt) { | ||
grunt.initConfig({ | ||
svg_sprite: { | ||
options: { | ||
// Task-specific options go here. | ||
}, | ||
actions: { | ||
expand: true, | ||
cwd: '../core/img', | ||
src: [ | ||
'actions/*.svg' | ||
], | ||
dest: '../core', | ||
options: { | ||
mode: { | ||
css: { | ||
prefix: '.icon-', | ||
sprite: 'images/actions', | ||
dimensions: true, | ||
render: { | ||
scss: { | ||
dest: 'actions', | ||
template: 'sprite.scss' | ||
} | ||
} | ||
} | ||
}, | ||
|
||
shape: { | ||
id: { | ||
/** | ||
* @param {string} name | ||
* @returns {string} | ||
*/ | ||
generator: function (name) { | ||
return name.substring('actions/'.length, name.indexOf('.svg')); | ||
} | ||
}, | ||
|
||
spacing: { | ||
padding: 100 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-svg-sprite'); | ||
|
||
grunt.registerTask('default', ['svg_sprite']); | ||
}; | ||
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,13 @@ | ||
%svg-common { | ||
background: url("{{{sprite}}}") no-repeat; | ||
} | ||
|
||
{{#shapes}} | ||
{{#selector.shape}}{{expression}}{{^last}},{{/last}}{{/selector.shape}} { | ||
@extend %svg-common; | ||
background-position: ({{position.absolute.x}}px - ({{width.outer}}px - {{width.inner}}px)/2) ({{position.absolute.y}}px - ({{height.outer}}px - {{height.inner}}px)/2); | ||
width: {{width.inner}}px; | ||
height: {{height.inner}}px; | ||
} | ||
|
||
{{/shapes}} |
Oops, something went wrong.
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.
I would really love to have a make file for this, that takes care of installing grunt and calling the right binaries, etc ... I don't want to fiddle around how to install it and which version and what the command then is.
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 can add one ofc