0

I'm used to building a asset compilation system with Grunt or Gulp. Using Gulp's livereload and the Chrome livereload plugin, I have a pretty sweet system where it watches for changes of certain file types and reloads only the file that were changed. With ember-cli, when I change a CSS file, it just reloads the entire page, rather than just reloading the CSS file. This gets to be a pain when I'm trying to style a deeply nested process. Any ideas/thoughts on how to get this working with Ember CLI correctly?

4

2 回答 2

2

我相信这仍然是 Ember CLI 的一项工作,并计划在未来的版本中发布,或者取决于 Broccoli 中的修复。见https://github.com/stefanpenner/ember-cli/issues/2371

我为解决这个问题所做的工作可能并不理想,但我最终使用 grunt,并使用 shell 命令运行ember build,将输出复制到由另一台服务器提供服务的不同目录(在我的情况下为 IIS express ),然后手动查看我的文件。

这是我的 grunt 文件中的片段。我相信你可以使用 Gulp 完成同样的任务。

    shell: {
        prod: {
            command: 'ember build --environment production'
        },

        dev: {
            command: 'ember build'
        }
    },
    copy: {
        dev: {
            files: [{
                src: '**',
                dest: '../Server/Content/js',
                cwd: 'dist/content/js',
                expand: true
            }, {
                src: '**',
                dest: '../Server/content/css',
                cwd: 'dist/content/css',
                expand: true
            }, {
                src: 'dist/index.html',
                dest: '../Server/Views/Home/Root.cshtml'

            }]
        }
    },

    watch: {
        dev: {
            files: [
                'app/**/*.js', 'app/**/*.hbs'
            ],
            tasks: ['_buildDev'],
            options: {
                livereload: true
            }
        },

        less: {
            files: [
                'app/**/*.less'
            ],
            tasks: ['shell:dev', 'copy:dev']
        },

        css: {
            files: [
                '../Server/Content/css/**/*'
            ],
            options: {
                livereload: true
            }
        }
    }
于 2014-11-25T18:20:52.690 回答
1

官方支持正在进行中,同时尝试这个 ember-addon https://www.npmjs.com/package/ember-cli-styles-reloader

于 2015-03-08T14:37:55.850 回答