Skip to content

Commit ee4f31b

Browse files
author
Walker Leite
committed
add support for css modules
1 parent c282c9b commit ee4f31b

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

template/client/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
<body>
88
<div id="app"></div>
99
<script src="bundle.js"></script>
10+
<link rel="stylesheet" href="bundle.css">
1011
</body>
1112
</html>

template/gulp-tasks/build.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import path from 'path';
55
import browserify from 'browserify';
66
import vueify from 'vueify';
77
import babelify from 'babelify';
8+
import modulesify from 'css-modulesify';
89
import source from 'vinyl-source-stream';
910
import buffer from 'vinyl-buffer';
1011
import {dirs} from './config.js';
@@ -27,6 +28,14 @@ gulp.task('build:client', ['copy:client'], () => {
2728
transform: [babelify, vueify],
2829
});
2930

31+
b.plugin(modulesify, {
32+
output: path.resolve(
33+
dirs.buildClient,
34+
'bundle.css',
35+
),
36+
global: true
37+
});
38+
3039
return b.bundle()
3140
.pipe(source('bundle.js'))
3241
.pipe(buffer())

template/gulp-tasks/copy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import path from 'path';
33
import {dirs} from './config.js';
44

55
gulp.task('copy:client', function() {
6-
return gulp.src(dirs.srcClient + '/**/*.!(vue|js)')
7-
.pipe(gulp.dest(path.resolve(dirs.build)));
6+
return gulp.src(dirs.srcClient + '/**/!(*.vue|*.js)')
7+
.pipe(gulp.dest(path.resolve(dirs.buildClient)));
88
});

template/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"babel-preset-es2015": "^6.24.1",
3030
"babelify": "^7.3.0",
3131
"browserify": "^14.4.0",
32+
"css-modulesify": "^0.28.0",
3233
"chai": "^4.1.0",
3334
"chai-http": "^3.0.0",
3435
"eslint": "^3.17.1",

0 commit comments

Comments
 (0)