0022286b46
* first attempt * progress * working * working * test timeago * rm * get timeago working * reduce size * fix whitespace * more intl stuff * more effort * more work * more progress * more work * more intl * set lang=LOCALE * flatten * more work * add ltr/rtl * more work * add comments * yet more work * still more work * more work * fix tests * more test and string fixes * fix test * fix test * fix test * fix some more strings, add test * fix snackbar * fix } * fix typo * fix english * measure perf * start on french * more work on french * more french * more french * finish french * fix some missing translations * update readme * fix test
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
const svgs = require('../bin/svgs')
|
|
const fs = require('fs')
|
|
const path = require('path')
|
|
const $ = require('cheerio')
|
|
|
|
const inlineSvgs = svgs.filter(_ => _.inline).map(_ => `#${_.id}`)
|
|
const allSvgs = {}
|
|
const $inlineHtml = $(fs.readFileSync(path.join(__dirname, '../src/template.html'), 'utf8'))
|
|
const $externalSvgs = $(fs.readFileSync(path.join(__dirname, '../static/icons.svg'), 'utf8'))
|
|
svgs.forEach(_ => {
|
|
const $inlineSvg = $inlineHtml.find(`#${_.id}`)
|
|
const $svg = $inlineSvg.length ? $inlineSvg : $externalSvgs.find(`#${_.id}`)
|
|
|
|
allSvgs[`#${_.id}`] = {
|
|
viewBox: $svg.attr('viewBox'),
|
|
html: $svg.html()
|
|
}
|
|
})
|
|
const mode = process.env.NODE_ENV || 'production'
|
|
const dev = mode === 'development'
|
|
|
|
const resolve = {
|
|
extensions: ['.js', '.json', '.html'],
|
|
mainFields: ['svelte', 'module', 'browser', 'main'],
|
|
alias: {
|
|
// All browsers we target support Intl.PluralRules, so format-message-interpret can fall back to that. This file is
|
|
// pretty big (9.83kB) and it's not needed.
|
|
'./plurals': 'lodash-es/noop'
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
mode,
|
|
dev,
|
|
resolve,
|
|
inlineSvgs,
|
|
allSvgs
|
|
}
|