Skip to content

Commit 9b78d17

Browse files
committed
Merge pull request #4 from joeybaker/removeRequireHook
replace babel require hook with a build step
2 parents 18f1589 + a952acd commit 9b78d17

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ build/Release
2525
# Dependency directory
2626
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
2727
node_modules
28+
29+
dist/

.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Generated by dmn (https://github.com/inikulin/dmn)
2+
3+
.git*
4+
.npmignore
5+
test/
6+
src/

index.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
11
'use strict';
22

3-
var path = require('path');
4-
5-
var escape = function (str) {
6-
return str.replace(/[\[\]\/{}()*+?.\\^$|-]/g, '\\$&');
7-
};
8-
9-
var regexp = ['src', 'test'].map(function (i) {
10-
return '^' + escape(path.join(__dirname, i) + path.sep);
11-
}).join('|');
12-
13-
require('babel/register')({
14-
only: new RegExp('(' + regexp + ')'),
15-
ignore: false,
16-
loose: 'all'
17-
});
18-
19-
module.exports = require('./src');
3+
module.exports = require('./dist');

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@
44
"description": "A require hook to compile CSS Modules on the fly",
55
"main": "index.js",
66
"dependencies": {
7-
"babel": "^5.8.20",
87
"postcss": "^4.1.16",
98
"postcss-modules-extract-imports": "0.0.5",
109
"postcss-modules-local-by-default": "0.0.9",
1110
"postcss-modules-scope": "0.0.8"
1211
},
1312
"devDependencies": {
13+
"babel": "^5.8.20",
1414
"css-modules-loader-core": "0.0.12",
15+
"in-publish": "^2.0.0",
1516
"mocha": "^2.2.5"
1617
},
1718
"scripts": {
18-
"test": "mocha --compilers js:babel/register"
19+
"test": "npm run -s build && mocha --compilers js:babel/register",
20+
"build": "babel src --out-dir dist",
21+
"prepublish": "in-publish && npm run -s build || in-install"
1922
},
2023
"repository": {
2124
"type": "git",

0 commit comments

Comments
 (0)