first commit
This commit is contained in:
26
admin/webpack/assets/fonts/css.hbs
Normal file
26
admin/webpack/assets/fonts/css.hbs
Normal file
@@ -0,0 +1,26 @@
|
||||
@font-face {
|
||||
font-family: "{{fontName}}";
|
||||
src: {{{src}}};
|
||||
}
|
||||
|
||||
{{baseSelector}}:before {
|
||||
display: inline-block;
|
||||
font-family: {{fontName}};
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
line-height: 1;
|
||||
text-decoration: inherit;
|
||||
text-rendering: optimizeLegibility;
|
||||
text-transform: none;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
{{#each codepoints}}
|
||||
.{{../classPrefix}}{{@key}}:before {
|
||||
content: "\\{{this}}";
|
||||
}
|
||||
{{/each}}
|
||||
35
admin/webpack/assets/fonts/html.hbs
Normal file
35
admin/webpack/assets/fonts/html.hbs
Normal file
@@ -0,0 +1,35 @@
|
||||
<style>
|
||||
.preview {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.preview__icon {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.preview__list {
|
||||
column-count: 3;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
/* @formatter:off */
|
||||
.preview__list {{baseSelector}} {
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
{{{styles}}}
|
||||
/* @formatter:on */
|
||||
</style>
|
||||
|
||||
<h1 class="text-center m-b-1">{{fontName}}</h1>
|
||||
|
||||
<div class="preview__list">
|
||||
{{#each names}}
|
||||
<div class="preview">
|
||||
<span class="preview__icon">
|
||||
<span class="fc {{../classPrefix}}{{this}}"></span>
|
||||
</span>
|
||||
<span>{{this}}</span>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
31
admin/webpack/assets/fonts/icons-merge.js
Normal file
31
admin/webpack/assets/fonts/icons-merge.js
Normal file
@@ -0,0 +1,31 @@
|
||||
const process = require('process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const currDir = process.cwd();
|
||||
|
||||
let icons = [];
|
||||
let iconsNames = [];
|
||||
|
||||
if (fs.existsSync(currDir + '/templates/icons/')) {
|
||||
const filesShop = fs.readdirSync(currDir + '/templates/icons/');
|
||||
|
||||
filesShop.forEach(file => {
|
||||
if (path.extname(file) === '.svg') {
|
||||
icons.push(currDir + '/templates/icons/' + file);
|
||||
iconsNames.push(file);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (fs.existsSync(currDir + '/admin/static/icons/')) {
|
||||
const filesEngine = fs.readdirSync(currDir + '/admin/static/icons/');
|
||||
|
||||
filesEngine.forEach(file => {
|
||||
if (path.extname(file) === '.svg' && !iconsNames.includes(file)) {
|
||||
icons.push(currDir + '/admin/static/icons/' + file);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
module.exports = icons;
|
||||
19
admin/webpack/assets/fonts/icons-sass.font.js
Normal file
19
admin/webpack/assets/fonts/icons-sass.font.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const icons = require('./icons-merge');
|
||||
const handlebars = require('handlebars');
|
||||
|
||||
handlebars.registerHelper('toHex', int => {
|
||||
return '\\' + int.toString(16);
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
'files': icons,
|
||||
'fontName': '_icons',
|
||||
'types': [],
|
||||
'emitCodepoints': [{fileName:'icons-list.json', type: 'json'}],
|
||||
'html': true,
|
||||
'htmlDest': '_icons.scss',
|
||||
'htmlTemplate': 'scss.hbs',
|
||||
'cssTemplate': 'scss.hbs',
|
||||
'classPrefix': '',
|
||||
'baseSelector': '.fc',
|
||||
};
|
||||
14
admin/webpack/assets/fonts/icons.font.js
Normal file
14
admin/webpack/assets/fonts/icons.font.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const icons = require('./icons-merge');
|
||||
// const Encore = require('@symfony/webpack-encore');
|
||||
// const filename = Encore.isProduction() ? 'app.[fontname].[chunkhash].[ext]' : 'app.[fontname].[ext]';
|
||||
const filename = 'app.[fontname].[chunkhash].[ext]';
|
||||
|
||||
module.exports = {
|
||||
files: icons,
|
||||
fontName: 'icons',
|
||||
classPrefix: '',
|
||||
baseSelector: '.fc',
|
||||
types: ['woff2', 'woff'],
|
||||
fileName: filename,
|
||||
cssTemplate: './css.hbs'
|
||||
};
|
||||
4
admin/webpack/assets/fonts/list.hbs
Normal file
4
admin/webpack/assets/fonts/list.hbs
Normal file
@@ -0,0 +1,4 @@
|
||||
[{"name":"Bez ikony", "value":"","icon":""}
|
||||
{{#each names}}
|
||||
,{"name":"{{this}}", "value":"{{this}}","icon":"{{../classPrefix}}{{this}}"}
|
||||
{{/each}}]
|
||||
30
admin/webpack/assets/fonts/scss.hbs
Normal file
30
admin/webpack/assets/fonts/scss.hbs
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
$webfont-icons: () !default;
|
||||
|
||||
$webfont-icons: map-merge($webfont-icons, (
|
||||
{{#each codepoints}}
|
||||
'{{@key}}': ('icons' '{{this}}'),
|
||||
{{/each}}
|
||||
));
|
||||
|
||||
@mixin webfont-icon($name) {
|
||||
line-height: 1;
|
||||
|
||||
$icon: map-get($webfont-icons, $name);
|
||||
&:before {
|
||||
font-family: nth($icon, 1) !important;
|
||||
font-style: normal;
|
||||
font-weight: normal !important;
|
||||
vertical-align: top;
|
||||
content: str-slice('\x', 1, 1) + nth($icon, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@mixin webfont-content($name) {
|
||||
$icon: map-get($webfont-icons, $name);
|
||||
content: str-slice('\x', 1, 1) + nth($icon, 2);
|
||||
}
|
||||
|
||||
{{#each codepoints}}
|
||||
${{@key}}: '{{toHex this}}';
|
||||
{{/each}}
|
||||
Reference in New Issue
Block a user