forked from twitter/opensource-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clean_feather_css
executable file
·34 lines (26 loc) · 939 Bytes
/
clean_feather_css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env node
'use strict';
/*
Cleans up Feather CSS assets for use on twitter.github.io. Run this whenever
installing new versions of Feather.
*/
const fs = require('fs');
const path = require('path');
const ROOT_PATH = path.join(__dirname, '..');
const FEATHER_CSS_PATHS = [
path.join(ROOT_PATH, 'css/feather-component-button.css'),
path.join(ROOT_PATH, 'css/feather-component-grid.css'),
path.join(ROOT_PATH, 'css/feather-core.css')
];
function addLegalLines() {
const copyrightYear = new Date().getFullYear();
const encoding = 'utf-8';
const legalLine = `/*! Copyright ${copyrightYear} Twitter Inc. All rights reserved. */`;
FEATHER_CSS_PATHS.forEach(filePath => {
const oldCode = fs.readFileSync(filePath, { encoding });
if (oldCode.startsWith(legalLine)) { return; }
const newCode = `${legalLine}\n\n${oldCode}`;
fs.writeFileSync(filePath, newCode, { encoding });
});
}
addLegalLines();