Skip to content

Commit 8c4ae44

Browse files
author
Yaroslav Kasperovich
committed
Improve readme, generator
1 parent 8cfd891 commit 8c4ae44

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ With built-in:
66
* `cache-loader`
77
* `thread-loader`
88
* `babel-loader`
9-
* `src/main.coffee` support if you're not using `config.pages`
109

1110
## Installation
1211

@@ -16,6 +15,27 @@ According to [this](https://cli.vuejs.org/guide/plugins-and-presets.html#install
1615
vue add coffee
1716
```
1817

18+
## Common usage
19+
20+
Usually you write SFC like this
21+
22+
```vue
23+
<template>
24+
<button @click="onclick">
25+
<slot></slot>
26+
</button>
27+
</template>
28+
29+
<script lang="coffee">
30+
export default
31+
name: "Button"
32+
props:
33+
onclick:
34+
type: Function
35+
required: false
36+
</script>
37+
```
38+
1939
## Entries
2040

2141
According to [this](https://cli.vuejs.org/config/#configurewebpack) you can add entries using your `vue.config.js` like so:

generator.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
module.exports = function(API) {
1+
module.exports = (API) => {
22
return API.extendPackage({
33
devDependencies: {
4-
"coffee-loader": "^0.9.0",
5-
"coffeescript": "^2.3.2",
6-
}
4+
coffeescript: require("./package.json").peerDependencies.coffeescript,
5+
},
76
});
8-
}
7+
};

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ module.exports = (API, projectOptions) => {
88

99
const coffeeRule = config.module.rule("coffee").test(/\.coffee$/);
1010

11-
coffeeRule.exclude.add(() => ["node_modules", "bower_components"]).end();
12-
1311
coffeeRule.use("cache-loader").loader(require.resolve("cache-loader"));
1412

1513
if (process.env.NODE_ENV === "production" && !!projectOptions.parallel) {
@@ -31,5 +29,7 @@ module.exports = (API, projectOptions) => {
3129
}
3230

3331
coffeeRule.use("coffee-loader").loader(require.resolve("coffee-loader"));
32+
33+
coffeeRule.exclude.add(() => ["node_modules", "bower_components"]).end();
3434
});
3535
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cli-plugin-coffee",
3-
"version": "0.5.6",
3+
"version": "0.5.7",
44
"description": "CoffeeScript2 support for your @vue/cli project",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)