使用Stylus和Webpack(Watch)

时间:2017-10-23 00:47:36

标签: javascript node.js npm webpack stylus

我开始使用一个JS应用程序,使用Babel + Webpack + Npm,我的样式是用手写笔完成的,因为我使用的是我构建的Webpack运行命令,我想用它来运行以下命令我通常用于Stylus:

stylus -u nib -w ./app/stylus/ --out ./app/stylesheets

这是我的package.json

{
    "name": "catch-and-run",
    "version": "1.0.0",
    "description": "Catch and Run game! DOOM 1993 Inspired",
    "main": "./app/javascripts/main.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "build": "webpack --progress -p",
        "watch": "webpack --progress --watch"
    },
    "repository": {
        "type": "git",
        "url": "git+https://github.com/Nikodermus/catch-and-run-game.git"
    },
    "keywords": [
        "game",
        "doom",
        "nikodermus"
    ],
    "author": "Nicolas M. Pardo | Nikodermus",
    "license": "MIT",
    "bugs": {
        "url": "https://github.com/Nikodermus/catch-and-run-game/issues"
    },
    "homepage": "https://github.com/Nikodermus/catch-and-run-game#readme",
    "dependencies": {
        "howler": "^2.0.5",
        "html2canvas": "^0.5.0-beta4",
        "jquery": "^3.2.1"
    },
    "devDependencies": {
        "babel-core": "^6.26.0",
        "babel-loader": "^7.1.2",
        "babel-plugin-transform-es2015-for-of": "^6.23.0",
        "babel-polyfill": "^6.26.0",
        "babel-preset-env": "^1.6.1",
        "webpack": "^3.8.1"
    }
}

这是我的webpack.config.js

module.exports = {
    entry: {
        bundle: './app/javascripts/game_engine.js',
    },
    output: {
        filename: '[name].js',
        path: __dirname + '/assets/javascripts/'
    },
    module: {
        rules: [{
            test: /\.js$/,
            exclude: /node_modules/,
            use: {
                loader: 'babel-loader',
                options: {
                    presets: ['env']
                }
            }
        }]
    }
};

0 个答案:

没有答案