inline svg in production html

This commit is contained in:
Maxim Kadushkin 2017-07-17 14:57:12 +03:00
parent 86c3493c1c
commit 19c0a3509f
8 changed files with 74 additions and 65 deletions

View file

@ -282,24 +282,7 @@
};
</script>
<svg style="display: none;">
<symbol id="svg-btn-comments" viewBox="0 0 20 20">
<path d="M16,4H4C3.45,4,3,4.45,3,5v9c0,0.55,0.45,1,1,1h2l2,2h1l2-2h5c0.55,0,1-0.45,1-1V5C17,4.45,16.55,4,16,4zM16,14h-5h-0.414l-2,2H8.414l-2-2H6H4V5h12V14z"/>
<rect x="6" y="7" width="8" height="1"/>
<rect x="6" y="9" width="8" height="1"/>
<rect x="6" y="11" width="8" height="1"/>
</symbol>
<symbol id="svg-btn-goback" viewBox="0 20 20 20">
<path d="M17,26h-6v-1c0-0.553-0.448-1-1-1H3c-0.552,0-1,0.447-1,1v11c0,0.553,0.448,1,1,1h14c0.552,0,1-0.447,1-1v-9C18,26.447,17.552,26,17,26z M17,36H3V25h7v1c0,0.553,0.448,1,1,1h6v1V36z"/>
<polygon points="13,31 10,28 10,30 6,30 6,32 10,32 10,34 "/>
</symbol>
<symbol id="svg-btn-users" viewBox="0 0 20 20">
<path d="M16.469,14.184l-0.161-1.113c0.658-0.479,1.118-1.524,1.118-2.319c0-1.092-0.863-2.013-1.926-2.013c-1.063,0-1.925,0.868-1.925,1.961c0,0.795,0.46,1.766,1.118,2.242l-0.162,1.247c-0.461,0.039-0.863,0.108-1.214,0.215
c-0.886-1.419-2.496-2.061-3.997-2.226l-0.129-0.844c0.903-0.804,1.559-2.239,1.559-3.48c0-1.85-1.458-3.354-3.25-3.354S4.25,5.985,4.25,7.811c0,1.23,0.644,2.616,1.562,3.419l-0.135,0.952C3.459,12.427,1,13.705,1,17h18
C19,16,18.387,14.345,16.469,14.184z M2.517,16c0.136-1.908,1.116-2.647,3.642-2.86l0.397-0.033l0.328-2.317L6.64,10.612C5.86,10.048,5.25,8.816,5.25,7.811C5.25,6.536,6.26,5.5,7.5,5.5s2.25,1.056,2.25,2.354c0,1.024-0.624,2.312-1.391,2.868L8.113,10.9
l0.337,2.202l0.393,0.033c2.525,0.213,3.505,0.952,3.641,2.864H2.517z"/>
</symbol>
</svg>
<inline src="../../common/main/resources/img/header/buttons.svg" />
<div id="viewport"></div>
<script data-main="app" src="../../../vendor/requirejs/require.js"></script>

View file

@ -355,26 +355,7 @@
};
</script>
<svg style="display: none;">
<symbol id="svg-btn-comments" viewBox="0 0 20 20">
<path d="M16,4H4C3.45,4,3,4.45,3,5v9c0,0.55,0.45,1,1,1h2l2,2h1l2-2h5c0.55,0,1-0.45,1-1V5C17,4.45,16.55,4,16,4z
M16,14h-5h-0.414l-2,2H8.414l-2-2H6H4V5h12V14z"/>
<rect x="6" y="7" width="8" height="1"/>
<rect x="6" y="9" width="8" height="1"/>
<rect x="6" y="11" width="8" height="1"/>
</symbol>
<symbol id="svg-btn-goback" viewBox="0 20 20 20">
<path d="M17,26h-6v-1c0-0.553-0.448-1-1-1H3c-0.552,0-1,0.447-1,1v11c0,0.553,0.448,1,1,1h14
c0.552,0,1-0.447,1-1v-9C18,26.447,17.552,26,17,26z M17,36H3V25h7v1c0,0.553,0.448,1,1,1h6v1V36z"/>
<polygon points="13,31 10,28 10,30 6,30 6,32 10,32 10,34 "/>
</symbol>
<symbol id="svg-btn-users" viewBox="0 0 20 20">
<path d="M16.469,14.184l-0.161-1.113c0.658-0.479,1.118-1.524,1.118-2.319c0-1.092-0.863-2.013-1.926-2.013c-1.063,0-1.925,0.868-1.925,1.961c0,0.795,0.46,1.766,1.118,2.242l-0.162,1.247c-0.461,0.039-0.863,0.108-1.214,0.215
c-0.886-1.419-2.496-2.061-3.997-2.226l-0.129-0.844c0.903-0.804,1.559-2.239,1.559-3.48c0-1.85-1.458-3.354-3.25-3.354S4.25,5.985,4.25,7.811c0,1.23,0.644,2.616,1.562,3.419l-0.135,0.952C3.459,12.427,1,13.705,1,17h18
C19,16,18.387,14.345,16.469,14.184z M2.517,16c0.136-1.908,1.116-2.647,3.642-2.86l0.397-0.033l0.328-2.317L6.64,10.612C5.86,10.048,5.25,8.816,5.25,7.811C5.25,6.536,6.26,5.5,7.5,5.5s2.25,1.056,2.25,2.354c0,1.024-0.624,2.312-1.391,2.868L8.113,10.9
l0.337,2.202l0.393,0.033c2.525,0.213,3.505,0.952,3.641,2.864H2.517z"/>
</symbol>
</svg>
<inline src="../../common/main/resources/img/header/buttons.svg" />
<div id="viewport"></div>

View file

@ -281,26 +281,7 @@
};
</script>
<svg style="display: none;">
<symbol id="svg-btn-comments" viewBox="0 0 20 20">
<path d="M16,4H4C3.45,4,3,4.45,3,5v9c0,0.55,0.45,1,1,1h2l2,2h1l2-2h5c0.55,0,1-0.45,1-1V5C17,4.45,16.55,4,16,4z
M16,14h-5h-0.414l-2,2H8.414l-2-2H6H4V5h12V14z"/>
<rect x="6" y="7" width="8" height="1"/>
<rect x="6" y="9" width="8" height="1"/>
<rect x="6" y="11" width="8" height="1"/>
</symbol>
<symbol id="svg-btn-goback" viewBox="0 20 20 20">
<path d="M17,26h-6v-1c0-0.553-0.448-1-1-1H3c-0.552,0-1,0.447-1,1v11c0,0.553,0.448,1,1,1h14
c0.552,0,1-0.447,1-1v-9C18,26.447,17.552,26,17,26z M17,36H3V25h7v1c0,0.553,0.448,1,1,1h6v1V36z"/>
<polygon points="13,31 10,28 10,30 6,30 6,32 10,32 10,34 "/>
</symbol>
<symbol id="svg-btn-users" viewBox="0 0 20 20">
<path d="M16.469,14.184l-0.161-1.113c0.658-0.479,1.118-1.524,1.118-2.319c0-1.092-0.863-2.013-1.926-2.013c-1.063,0-1.925,0.868-1.925,1.961c0,0.795,0.46,1.766,1.118,2.242l-0.162,1.247c-0.461,0.039-0.863,0.108-1.214,0.215
c-0.886-1.419-2.496-2.061-3.997-2.226l-0.129-0.844c0.903-0.804,1.559-2.239,1.559-3.48c0-1.85-1.458-3.354-3.25-3.354S4.25,5.985,4.25,7.811c0,1.23,0.644,2.616,1.562,3.419l-0.135,0.952C3.459,12.427,1,13.705,1,17h18
C19,16,18.387,14.345,16.469,14.184z M2.517,16c0.136-1.908,1.116-2.647,3.642-2.86l0.397-0.033l0.328-2.317L6.64,10.612C5.86,10.048,5.25,8.816,5.25,7.811C5.25,6.536,6.26,5.5,7.5,5.5s2.25,1.056,2.25,2.354c0,1.024-0.624,2.312-1.391,2.868L8.113,10.9
l0.337,2.202l0.393,0.033c2.525,0.213,3.505,0.952,3.641,2.864H2.517z"/>
</symbol>
</svg>
<inline src="../../common/main/resources/img/header/buttons.svg" />
<div id="viewport"></div>

View file

@ -23,6 +23,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-inline');
grunt.loadNpmTasks('grunt-svgmin');
function doRegisterTask(name, callbackConfig) {
return grunt.registerTask(name + '-init', function() {
@ -142,7 +144,12 @@ module.exports = function(grunt) {
options: {
force: true
},
files: packageFile['main']['clean']
prebuild: {
src: packageFile['main']['clean']
},
postbuild: {
src: packageFile.main.svgicons.clean
}
},
less: {
@ -210,6 +217,24 @@ module.exports = function(grunt) {
'index-page': {
files: packageFile['main']['copy']['index-page']
}
},
inline: {
dist: {
src: packageFile.main.copy['index-page'][0].dest,
dest: packageFile.main.copy['index-page'][0].dest
}
},
svgmin: {
options: {
plugins: [{
cleanupIDs: false
}]
},
dist: {
files: packageFile.main.svgicons.common
}
}
});
});
@ -375,8 +400,8 @@ module.exports = function(grunt) {
grunt.registerTask('deploy-jsziputils', ['jsziputils-init', 'clean', 'copy']);
grunt.registerTask('deploy-requirejs', ['requirejs-init', 'clean', 'uglify']);
grunt.registerTask('deploy-app-main', ['main-app-init', 'clean', 'imagemin', 'less', 'requirejs', 'concat',
'copy', 'replace:writeVersion']);
grunt.registerTask('deploy-app-main', ['main-app-init', 'clean:prebuild', 'imagemin', 'less', 'requirejs', 'concat',
'copy', 'svgmin', 'inline', 'replace:writeVersion', 'clean:postbuild']);
grunt.registerTask('deploy-app-mobile', ['mobile-app-init', 'clean:deploy', 'cssmin', 'copy:template-backup',
'htmlmin', 'requirejs', 'concat', 'copy:template-restore',

View file

@ -1,7 +1,7 @@
{
"name": "common",
"version": "4.3.0",
"build": 1,
"build": 32,
"homepage": "http://www.onlyoffice.com",
"private": true,
"sdk": {

View file

@ -1,7 +1,7 @@
{
"name": "documenteditor",
"version": "4.3.0",
"build": 1112,
"build": 1143,
"homepage": "http://www.onlyoffice.com",
"private": true,
"main": {
@ -164,6 +164,19 @@
"dest": "../deploy/web-apps/apps/documenteditor/main/index.html"
}
]
},
"svgicons": {
"common": [
{
"expand": true,
"cwd": "../apps/common/main/resources/img",
"src": "**/*.svg",
"dest": "../deploy/web-apps/apps/common/main/resources/img"
}
],
"clean": [
"../deploy/web-apps/apps/common"
]
}
},
"mobile": {

View file

@ -1,7 +1,7 @@
{
"name": "presentationeditor",
"version": "4.3.0",
"build": 774,
"build": 776,
"homepage": "http://www.onlyoffice.com",
"private": true,
"main": {
@ -164,6 +164,19 @@
"dest": "../deploy/web-apps/apps/presentationeditor/main/index.html"
}
]
},
"svgicons": {
"common": [
{
"expand": true,
"cwd": "../apps/common/main/resources/img",
"src": "**/*.svg",
"dest": "../deploy/web-apps/apps/common/main/resources/img"
}
],
"clean": [
"../deploy/web-apps/apps/common"
]
}
},
"mobile": {

View file

@ -1,7 +1,7 @@
{
"name": "spreadsheeteditor",
"version": "4.3.0",
"build": 879,
"build": 881,
"homepage": "http://www.onlyoffice.com",
"private": true,
"main": {
@ -178,6 +178,19 @@
"dest": "../deploy/web-apps/apps/spreadsheeteditor/main/index.html"
}
]
},
"svgicons": {
"common": [
{
"expand": true,
"cwd": "../apps/common/main/resources/img",
"src": "**/*.svg",
"dest": "../deploy/web-apps/apps/common/main/resources/img"
}
],
"clean": [
"../deploy/web-apps/apps/common"
]
}
},
"mobile": {