Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #15 from divio/bugfix/icon-prefix
Browse files Browse the repository at this point in the history
Changed the way iconset is generated
  • Loading branch information
vxsx committed Jan 9, 2018
2 parents eafea39 + a610418 commit 90efdd6
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ djangocms-boilerplate-webpack
- Fixed data attributes for correct messages consumption in django CMS 3.5
- Added example for preoading fonts in ``base.html`` template
- Added json generation for icons plugins
- Changed the names of the icons generated (iconset prefix is always added)


2.0.1
Expand Down
2 changes: 1 addition & 1 deletion static/iconset.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"iconClass": "icon",
"iconClassFix": "icon-",
"icons": [
"circle"
"icon-circle"
]
}

2 changes: 1 addition & 1 deletion static/sprites/icons.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions templates/includes/icon.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% load static %}<span class="icon icon-{{ icon|cut:"icon-" }}{% if color %} icon-{{ color }}{% endif %}{% if class %} {{ class }}{% endif %}">
{% load static %}<span class="icon {{ icon }}{% if color %} icon-{{ color }}{% endif %}{% if class %} {{ class }}{% endif %}">
<svg role="presentation">
{% if sprite %}<use xlink:href="{% static "sprites/"|add:sprite %}.svg#{{ icon|cut:"icon-" }}"></use>{% else %}<use xlink:href="{% static "sprites/icons.svg" %}#{{ icon|cut:"icon-" }}"></use>{% endif %}
{% if sprite %}<use xlink:href="{% static "sprites/"|add:sprite %}.svg#{{ icon|cut:"icon-" }}"></use>{% else %}<use xlink:href="{% static "sprites/icons.svg" %}#{{ icon }}"></use>{% endif %}
</svg>
{% if title %}
<span class="sr-only">{{ title }}</span>
{% endif %}
</span>
</span>
2 changes: 1 addition & 1 deletion tools/tasks/icons/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs');
module.exports = function(gulp, opts) {
return function() {
const list = fs.readdirSync(opts.PROJECT_PATH.svg + '/' + opts.svg).map(file =>
`"${file.replace(/\.svg$/, '')}"`
`"icon-${file.replace(/\.svg$/, '')}"`
).join(',\n');

const content = `
Expand Down
1 change: 1 addition & 0 deletions tools/tasks/icons/svgsprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = function(gulp, opts) {
mode: 'symbols',
preview: true,
svgPath: `../sprites/${opts.svg}.svg`,
selector: "icon-%f",
svg: {
symbols: `${opts.PROJECT_PATH.sprites}/${opts.svg}.svg`,
},
Expand Down

0 comments on commit 90efdd6

Please sign in to comment.