remove unused svg

This commit is contained in:
Robert Kaussow 2020-03-15 16:37:48 +01:00
parent ce88c11424
commit 5268306aed
3 changed files with 126 additions and 114 deletions

View file

@ -4,133 +4,150 @@ const sass = require('gulp-sass');
const minifyCSS = require('gulp-csso'); const minifyCSS = require('gulp-csso');
const cleanCSS = require('gulp-clean-css'); const cleanCSS = require('gulp-clean-css');
const autoprefixer = require('gulp-autoprefixer'); const autoprefixer = require('gulp-autoprefixer');
const iconfont = require('gulp-iconfont');
const realFavicon = require ('gulp-real-favicon'); const realFavicon = require('gulp-real-favicon');
const fs = require('fs'); const fs = require('fs');
const svgSprite = require('gulp-svg-sprite'); const svgSprite = require('gulp-svg-sprite');
var CSSDEST = 'static/' var CSSDEST = 'static/'
var FAVICON_DATA_FILE = 'src/favicon/faviconData.json'; var FAVICON_DATA_FILE = 'src/favicon/faviconData.json';
var TIMESTAMP = Math.round(Date.now() / 1000);
gulp.task('sass', function() { gulp.task('sass', function () {
return gulp.src('src/sass/main.scss') return gulp.src('src/sass/main.scss')
.pipe(sass({ errLogToConsole: true })) .pipe(sass({ errLogToConsole: true }))
.pipe(cleanCSS({format: 'beautify'})) .pipe(cleanCSS({ format: 'beautify' }))
.pipe(autoprefixer({ .pipe(autoprefixer({
cascade: false cascade: false
})) }))
.pipe(gulp.dest(CSSDEST)) .pipe(gulp.dest(CSSDEST))
.pipe(cleanCSS()) .pipe(cleanCSS())
.pipe(rename({ extname: '.min.css' })) .pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest(CSSDEST)) .pipe(gulp.dest(CSSDEST))
}); });
gulp.task('favicon-generate', function(done) { gulp.task('favicon-generate', function (done) {
realFavicon.generateFavicon({ realFavicon.generateFavicon({
masterPicture: 'src/favicon/favicon-master.svg', masterPicture: 'src/favicon/favicon-master.svg',
dest: 'static/favicon', dest: 'static/favicon',
iconsPath: '/', iconsPath: '/',
design: { design: {
ios: { ios: {
pictureAspect: 'backgroundAndMargin', pictureAspect: 'backgroundAndMargin',
backgroundColor: '#ffffff', backgroundColor: '#ffffff',
margin: '14%', margin: '14%',
assets: { assets: {
ios6AndPriorIcons: false, ios6AndPriorIcons: false,
ios7AndLaterIcons: false, ios7AndLaterIcons: false,
precomposedIcons: false, precomposedIcons: false,
declareOnlyDefaultIcon: true declareOnlyDefaultIcon: true
} }
}, },
desktopBrowser: {}, desktopBrowser: {},
windows: { windows: {
pictureAspect: 'whiteSilhouette', pictureAspect: 'whiteSilhouette',
backgroundColor: '#2b5797', backgroundColor: '#2b5797',
onConflict: 'override', onConflict: 'override',
assets: { assets: {
windows80Ie10Tile: false, windows80Ie10Tile: false,
windows10Ie11EdgeTiles: { windows10Ie11EdgeTiles: {
small: false, small: false,
medium: true, medium: true,
big: false, big: false,
rectangle: false rectangle: false
} }
} }
}, },
androidChrome: { androidChrome: {
pictureAspect: 'shadow', pictureAspect: 'shadow',
themeColor: '#ffffff', themeColor: '#ffffff',
manifest: { manifest: {
display: 'standalone', display: 'standalone',
orientation: 'notSet', orientation: 'notSet',
onConflict: 'override', onConflict: 'override',
declared: true declared: true
}, },
assets: { assets: {
legacyIcon: false, legacyIcon: false,
lowResolutionIcons: false lowResolutionIcons: false
} }
}, },
safariPinnedTab: { safariPinnedTab: {
pictureAspect: 'blackAndWhite', pictureAspect: 'blackAndWhite',
threshold: 74.21875, threshold: 74.21875,
themeColor: '#5bbad5' themeColor: '#5bbad5'
} }
}, },
settings: { settings: {
scalingAlgorithm: 'Mitchell', scalingAlgorithm: 'Mitchell',
errorOnImageTooSmall: false, errorOnImageTooSmall: false,
readmeFile: false, readmeFile: false,
htmlCodeFile: false, htmlCodeFile: false,
usePathAsIs: false usePathAsIs: false
}, },
markupFile: FAVICON_DATA_FILE markupFile: FAVICON_DATA_FILE
}, function() { }, function () {
done(); done();
}); });
}); });
gulp.task('favicon-check-update', function(done) { gulp.task('favicon-check-update', function (done) {
var currentVersion = JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).version; var currentVersion = JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).version;
realFavicon.checkForUpdates(currentVersion, function(err) { realFavicon.checkForUpdates(currentVersion, function (err) {
if (err) { if (err) {
throw err; throw err;
} }
}); });
done(); done();
}); });
gulp.task('svg-sprite',function() { gulp.task('svg-sprite', function () {
config = { config = {
svg: { svg: {
xmlDeclaration: false, xmlDeclaration: false,
rootAttributes: { rootAttributes: {
style: "position: absolute; width: 0; height: 0; overflow: hidden;" style: "position: absolute; width: 0; height: 0; overflow: hidden;"
} }
}, },
mode: { mode: {
inline: true, inline: true,
symbol: { symbol: {
dest: './', dest: './',
sprite: 'svg-icon-symbols.html', sprite: 'svg-icon-symbols.html',
bust: false, bust: false,
} }
} }
}; };
return gulp.src('src/icons/*.svg') return gulp.src('src/icons/*.svg')
.pipe(svgSprite(config)) .pipe(svgSprite(config))
.pipe(gulp.dest('layouts/partials/')); .pipe(gulp.dest('layouts/partials/'));
});
gulp.task('iconfont', function () {
return gulp.src(['assets/icons/*.svg'])
.pipe(iconfont({
fontName: 'myfont', // required
prependUnicode: true, // recommended option
formats: ['ttf', 'eot', 'woff'], // default, 'woff2' and 'svg' are available
timestamp: TIMESTAMP, // recommended to get consistent builds when watching files
}))
.on('glyphs', function (glyphs, options) {
// CSS templating, e.g.
console.log(glyphs, options);
})
.pipe(gulp.dest('www/fonts/'));
}); });
gulp.task('default', gulp.series( gulp.task('default', gulp.series(
'sass', 'sass',
'svg-sprite', 'svg-sprite',
'favicon-check-update', 'favicon-check-update',
'favicon-generate' 'favicon-generate'
)); ));
gulp.task('devel',function() { gulp.task('devel', function () {
gulp.watch('src/sass/**/*.*css', gulp.series('sass')); gulp.watch('src/sass/**/*.*css', gulp.series('sass'));
}); });

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

@ -1,5 +0,0 @@
<!-- Generated by IcoMoon.io -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<title>pencil</title>
<path d="M30.173 7.542l-0.314 0.314-5.726-5.729 0.313-0.313c0 0 1.371-1.813 3.321-1.813 0.859 0 1.832 0.353 2.849 1.37 3.354 3.354-0.443 6.171-0.443 6.171zM27.979 9.737l-19.499 19.506-8.48 2.757 2.756-8.485v-0.003h0.002l19.496-19.505 0.252 0.253zM2.76 29.239l4.237-1.219-2.894-3.082-1.343 4.301z"></path>
</svg>

Before

Width:  |  Height:  |  Size: 465 B