diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-12-17 14:35:30 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-12-17 14:35:30 +0900 |
| commit | d4fb399c95c65e4a6805e02074b8e5cc754a3822 (patch) | |
| tree | 4901d6b8828aada8275feb4787fcede57eb0bd27 /webpack/module/rules/fa.ts | |
| parent | Update api.ja.pug (diff) | |
| download | misskey-d4fb399c95c65e4a6805e02074b8e5cc754a3822.tar.gz misskey-d4fb399c95c65e4a6805e02074b8e5cc754a3822.tar.bz2 misskey-d4fb399c95c65e4a6805e02074b8e5cc754a3822.zip | |
なんかもうめっちゃ変えた
Diffstat (limited to 'webpack/module/rules/fa.ts')
| -rw-r--r-- | webpack/module/rules/fa.ts | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/webpack/module/rules/fa.ts b/webpack/module/rules/fa.ts index 47c72a28a1..891b78ece2 100644 --- a/webpack/module/rules/fa.ts +++ b/webpack/module/rules/fa.ts @@ -3,16 +3,7 @@ */ const StringReplacePlugin = require('string-replace-webpack-plugin'); - -import * as fontawesome from '@fortawesome/fontawesome'; -import * as regular from '@fortawesome/fontawesome-free-regular'; -import * as solid from '@fortawesome/fontawesome-free-solid'; -import * as brands from '@fortawesome/fontawesome-free-brands'; - -// Add icons -fontawesome.library.add(regular); -fontawesome.library.add(solid); -fontawesome.library.add(brands); +import { pattern, replacement } from '../../../src/common/build/fa'; export default () => ({ enforce: 'pre', @@ -20,41 +11,7 @@ export default () => ({ exclude: /node_modules/, loader: StringReplacePlugin.replace({ replacements: [{ - pattern: /%fa:(.+?)%/g, replacement: (_, key) => { - const args = key.split(' '); - let prefix = 'fas'; - const classes = []; - let transform = ''; - let name; - - args.forEach(arg => { - if (arg == 'R' || arg == 'S' || arg == 'B') { - prefix = - arg == 'R' ? 'far' : - arg == 'S' ? 'fas' : - arg == 'B' ? 'fab' : - ''; - } else if (arg[0] == '.') { - classes.push('fa-' + arg.substr(1)); - } else if (arg[0] == '-') { - transform = arg.substr(1).split('|').join(' '); - } else { - name = arg; - } - }); - - const icon = fontawesome.icon({ prefix, iconName: name }, { - classes: classes - }); - - if (icon) { - icon.transform = fontawesome.parse.transform(transform); - return `<i data-fa class="${name}">${icon.html[0]}</i>`; - } else { - console.warn(`'${name}' not found in fa`); - return ''; - } - } + pattern, replacement }] }) }); |