Skip to content
Snippets Groups Projects
Commit 4b2ea22c authored by Kushal Pandya's avatar Kushal Pandya
Browse files

Merge branch 'mg-update-icons-svg-import' into 'master'

Use file-loader for sprite icons within icon.vue

See merge request gitlab-org/gitlab-ce!31257
parents 8702dbcd b0ba7c72
No related branches found
No related tags found
No related merge requests found
// any import of '@gitlab/svgs/dist/icons.svg' will be overridden with this
// to avoid asset duplication between sprockets and webpack
export default gon && gon.sprite_icons;
<script>
import iconsPath from '@gitlab/svgs/dist/icons.svg';
// only allow classes in images.scss e.g. s12
const validSizes = [8, 10, 12, 14, 16, 18, 24, 32, 48, 72];
let iconValidator = () => true;
Loading
Loading
@@ -84,7 +86,7 @@ export default {
 
computed: {
spriteHref() {
return `${gon.sprite_icons}#${this.name}`;
return `${iconsPath}#${this.name}`;
},
iconTestClass() {
return `ic-${this.name}`;
Loading
Loading
Loading
Loading
@@ -90,6 +90,12 @@ const alias = {
 
// the following resolves files which are different between CE and EE
ee_else_ce: path.join(ROOT_PATH, 'app/assets/javascripts'),
// override loader path for icons.svg so we do not duplicate this asset
'@gitlab/svgs/dist/icons.svg': path.join(
ROOT_PATH,
'app/assets/javascripts/lib/utils/icons_path.js',
),
};
 
if (IS_EE) {
Loading
Loading
@@ -157,8 +163,16 @@ module.exports = {
exclude: /node_modules/,
loader: 'graphql-tag/loader',
},
{
test: /icons\.svg$/,
loader: 'file-loader',
options: {
name: '[name].[hash:8].[ext]',
},
},
{
test: /\.svg$/,
exclude: /icons\.svg$/,
loader: 'raw-loader',
},
{
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment