gulpclass
gulpclass copied to clipboard
Task 'clean-dist' is not in your gulpfile
I'm trying to use your code, to do it I created these files:
package.json
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"del": "^2.2.1",
"gulp": "^3.9.1",
"gulpclass": "^0.1.1",
"typescript": "^1.8.10"
}
}
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}
gulpclass.ts
import { Gulpclass, Task } from "gulpclass/Decorators";
let gulp = require("gulp");
let del = require("del");
@Gulpclass()
export class Gulpfile {
@Task("clean-dist")
clean(cb: Function) {
return del(["./dist/**"], cb);
}
}
gulpfile.js
eval(require("typescript").transpile(require("fs").readFileSync("./gulpclass.ts").toString()));
So, I execute:
gulp clean-dist
The output is:
Using gulpfile d:\Temp\Test\gulpfile.js
Task 'clean-dist' is not in your gulpfile
Please check the documentation for proper gulpfile formatting
```***
I don't know what I'm doing wrong, can someone help me?
In order to us the transpile with gulpfile.js you need to npm install --save-dev fs for require('fs')