add folder sprites to build

This commit is contained in:
OVSharova
2023-10-09 04:23:54 +03:00
parent 75d0c730ce
commit 8a6a4a9c09
14 changed files with 130 additions and 11 deletions

9
.gitignore vendored
View File

@ -27,8 +27,15 @@ win-linux/package/linux/urpmi/builddir
win-linux/package/linux/suse-rpm/builddir
win-linux/package/linux/tar
/common/loginpage/res/img/allconnect.svg
/common/loginpage/res/img/allwelcome.svg
/common/loginpage/res/img/format.svg
/common/loginpage/res/img/common.svg
common/loginpage/build/plugins/*
common/loginpage/build/node_modules/*
common/loginpage/build/sprites/node_modules
common/loginpage/deploy/*
common/loginpage/src/dlglogin.min.js
common/converter/*
@ -53,4 +60,4 @@ macos/build
macos/fastlane/node_modules
macos/fastlane/README.md
macos/fastlane/report.xml
macos/Vendor/ONLYOFFICE
macos/Vendor/ONLYOFFICE

View File

@ -12,7 +12,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadNpmTasks('grunt-inline');
grunt.loadNpmTasks('grunt-terser');
function doRegisterInitializeAppTask(name, appName, configFile) {
return grunt.registerTask('init-build-' + name, 'Initialize build ' + appName, function(){
defaultConfig = configFile;
@ -163,10 +163,14 @@ module.exports = function(grunt) {
}
});
grunt.registerTask('prebuild-sprites', function() {
require('./sprites/Gruntfile.js')(grunt,'../');
grunt.task.run('svg_sprite');
});
doRegisterInitializeAppTask('startpage', 'Desktop start page', 'startpage.json');
grunt.registerTask('deploy-desktop-startpage', ['desktop-app-extra', 'copy', 'less', 'terser:dialogconnect',
grunt.registerTask('deploy-desktop-startpage', ['prebuild-sprites','desktop-app-extra', 'copy', 'less', 'terser:dialogconnect',
'concat', 'clean', 'inline', 'terser:core', 'terser:langs', 'htmlmin', 'compile-html']);
grunt.registerTask('default', ['init-build-startpage','deploy-desktop-startpage']);
};

View File

@ -0,0 +1,93 @@
module.exports = function (grunt, rootpathprefix) {
const _path = rootpathprefix || '../../';
grunt.initConfig({
svg_sprite:{
options: {
svg: {
rootAttributes: {
//xmlns:'http://www.w3.org/2000/svg',
},
},
shape: {
id: {
separator: ""
},
transform: [{
svgo: {
plugins: [
'removeXMLNS',
{
name: "removeAttrs",
params: {
attrs: "(fill|stroke)"
}
},
]
},
}]
},
mode: {
symbol: {
},
},
},
allconnect: {
src: [`${_path}res/img/connect*.svg`],
dest: `${_path}res/img/`,
options: {
mode: {
symbol: {
inline: true,
dest: './',
sprite: `allconnect.svg`,
},
},
}
},
allwelcome: {
src: [`${_path}res/img/welcome*.svg`],
dest: `${_path}res/img/`,
options: {
mode: {
symbol: {
inline: true,
dest: './',
sprite: `allwelcome.svg`,
},
},
}
},
formats: {
src: [`${_path}res/img/formats-svg/*.svg`],
dest: `${_path}res/img/`,
options: {
mode: {
symbol: {
inline: true,
dest: './',
sprite: `format.svg`,
},
},
}
},
common: {
src: [`${_path}res/img/common-svg/*.svg`],
dest: `${_path}res/img/`,
options: {
mode: {
symbol: {
inline: true,
dest: './',
sprite: `common.svg`,
},
},
}
},
}
});
// Load in `grunt-spritesmith`
grunt.loadNpmTasks('grunt-svg-sprite');
grunt.registerTask('generate-sprite', ['svg_sprite']);
grunt.registerTask('default', ['generate-sprite']);
};

View File

@ -0,0 +1,15 @@
{
"name": "sprites",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"grunt-svg-sprite": "^2.0.2"
}
}

View File

Before

Width:  |  Height:  |  Size: 383 B

After

Width:  |  Height:  |  Size: 383 B

View File

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 380 B

View File

Before

Width:  |  Height:  |  Size: 651 B

After

Width:  |  Height:  |  Size: 651 B

View File

Before

Width:  |  Height:  |  Size: 368 B

After

Width:  |  Height:  |  Size: 368 B

View File

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 439 B

View File

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 439 B

View File

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 351 B

View File

Before

Width:  |  Height:  |  Size: 908 B

After

Width:  |  Height:  |  Size: 908 B

View File

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 469 B

View File

@ -111,14 +111,14 @@
</div>
<div class="injected-svg">
<inline src="../res/img/connect1.svg" />
<inline src="../res/img/connect2.svg" />
<inline src="../res/img/connect3.svg" />
<inline src="../res/img/connect1_dark.svg" />
<inline src="../res/img/connect2_dark.svg" />
<inline src="../res/img/connect3_dark.svg" />
<inline src="../res/img/welcome.svg" />
<inline src="../res/img/welcome_dark.svg" />
<inline src="../res/img/connect1-light.svg" />
<inline src="../res/img/connect2-light.svg" />
<inline src="../res/img/connect3-light.svg" />
<inline src="../res/img/connect1-dark.svg" />
<inline src="../res/img/connect2-dark.svg" />
<inline src="../res/img/connect3-dark.svg" />
<inline src="../res/img/welcome-light.svg" />
<inline src="../res/img/welcome-dark.svg" />
<inline src="../res/img/logo.svg" />
<inline src="../res/img/update_status.svg" />
</div>