首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >咕噜表不能取代sass file.please建议我在这里做错了什么

咕噜表不能取代sass file.please建议我在这里做错了什么
EN

Stack Overflow用户
提问于 2017-03-21 09:52:04
回答 1查看 30关注 0票数 1

我试着观察sass的变化,但是每当我更新sass files.Can时,我都无法在files.Can上看到任何变化,有些请建议我在这里做错了什么,我是刚开始抱怨js的。

代码语言:javascript
复制
 {
        "name": "test-scss",
        "version": "0.1.0",
        "devDependencies": {
            "bootstrap-sass": "^3.3.7",
            "grunt": "^1.0.1",
            "grunt-contrib-concat": "^1.0.1",
            "grunt-contrib-connect": "^1.0.2",
            "grunt-contrib-jshint": "~0.10.0",
            "grunt-contrib-nodeunit": "~0.4.1",
            "grunt-contrib-sass": "^1.0.0",
            "grunt-contrib-uglify": "~0.5.0",
            "grunt-contrib-watch": "^1.0.0"
        },
        "scripts": {
            "build-css": "node-sass --include-path scss sass/style.scss   css/main.css"
        }
    }
    /// here is my gruntjs file configuration

    module.exports = function(grunt) {
        grunt.initConfig({
            pkg: grunt.file.readJSON('package.json'),
            watch: {
                options: {
                    livereload: true
                },
                sass: {
                    files: ['**/*.scss'],
                    task: ['sass']
                },
                html: {
                    files: ['*.html']
                }
            },
            sass: {
                dist: {
                    files: {
                        'css/main.css': 'sass/style.scss'
                    }
                }
            },
            connect: {
                sever: {
                    options: {
                        keepalive: true,
                        hostname: 'localhost',
                        port: 3003,
                        base: '.',
                        open: true,
                        watch: true,
                        livereload: true
                    }
                }
            }
        });
        grunt.loadNpmTasks('grunt-contrib-watch');
        grunt.loadNpmTasks('grunt-contrib-sass');
        grunt.loadNpmTasks('grunt-contrib-connect');
        grunt.registerTask('default', ['sass', 'watch', 'connect']);
    };
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-21 10:38:55

Grunt watch是一个阻塞任务,因此永远无法访问grunt connect

只有在设置了grunt-contrib-connect时,keepalive: true才会阻塞,否则,只要运行grunt,它就会运行。当grunt watch无限期运行时,不需要强制grunt-contrib-connect为"keepalive

去修理。

代码语言:javascript
复制
keepalive: false //turn off keepalive

watch阻塞任务移动到最后执行

代码语言:javascript
复制
grunt.registerTask('default', ['sass','connect','watch']); 

如果您绝对需要同时运行两个阻塞任务,可以使用像grunt-concurrent https://stackoverflow.com/a/42319772/3656963这样的插件。

或者使用两个命令行分别调用每个任务。

还修正了错误:task: ['sass']tasks: ['sass']

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42923535

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档