forked from express-labs/pure-react-carousel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostbuild.js
28 lines (26 loc) · 822 Bytes
/
postbuild.js
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
// This script corrects the path for sourceMappingURL. PostCSS spits out the wrong name.
// This script is run automatically when you do `npm run build`. To run this script manually,
// do `node postbuild.js`
var replace = require('replace-in-file');
var escape = require('escape-string-regexp');
const baseDir = process.cwd();
replace({
files: [
'dist/react-carousel.cjs.css',
'dist/react-carousel.es.css',
'dist/react-carousel.cjs.css.map',
'dist/react-carousel.es.css.map',
],
from: [
/sourceMappingURL=index\.cjs\.css\.map/g,
/sourceMappingURL=index\.es\.css\.map/g,
new RegExp(escape(baseDir),'g'),
new RegExp(escape(baseDir),'g'),
],
to: [
'sourceMappingURL=react-carousel.cjs.css.map',
'sourceMappingURL=react-carousel.es.css.map',
'..',
'..',
],
});