Skip to content

Commit

Permalink
Update svg-to-js to aviod adblock issues, Remove excess dependencies (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikbacker authored Sep 15, 2017
1 parent 603036a commit 212075a
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 2,662 deletions.
6 changes: 0 additions & 6 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ First clone `@nrk/core-icons` and install its dependencies:
```bash
git clone git@github.com:nrkno/core-icons.git
cd core-icons
npm install --no-optional
npm install
```

## Building and committing
Expand Down
37 changes: 7 additions & 30 deletions bin/build.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,16 @@
/* eslint-disable no-console, no-process-exit */
const chalk = require('chalk');
const path = require('path');

const concatSvg = require('@nrk/svg-to-js');
const parseArgs = require('minimist');

const yearReplacePattern = '||YEAR_FOR_COPYRIGHT||';
const path = require('path');
const fs = require('fs');

const defaultOptions = {
const config = {
svgFileName: 'core-icons.js',
svgFileNameMin: 'core-icons.min.js',
srcPath: path.join(__dirname, '../src'),
distPath: path.join(__dirname, '../dist'),
banner: `Copyright (c) 2015-${yearReplacePattern} NRK <opensource@nrk.no>`
banner: `Copyright (c) 2015-${new Date().getFullYear()} NRK <opensource@nrk.no>`
};

console.log(chalk.yellow('Building SVG'));
const argv = parseArgs(process.argv.slice(2), {
string: [
'svgFileName',
'svgFileNameMin',
'srcPath',
'distPath',
'banner'
],
default: defaultOptions,
unknown: () => {
console.log(`Passed in invalid options: ${chalk.styles.red.open}${process.argv.slice(2)}${chalk.styles.red.close}`);
console.log('Usage: $ node build.js ');
Object.keys(defaultOptions).map((key) => console.log(` --${key} ${defaultOptions[key]}`));
console.log('');
process.exit(1);
}
});
argv.banner = argv.banner.replace(yearReplacePattern, new Date().getFullYear());
concatSvg(argv)
.then(() => console.log(chalk.green('Merged and minified SVG')))
console.log('Building SVG');
concatSvg(config)
.then(() => console.log('Merged and minified SVG'))
.catch((err) => console.log(err.stack));
2 changes: 1 addition & 1 deletion dist/core-icons.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-icons.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 212075a

Please sign in to comment.