指南针在运行咕噜声后找不到任何要编译的 sass 文件



我正在尝试运行compass来编译我的.scss文件。 我收到以下错误:

Running "compass:dist" (compass) task
Compass can't find any Sass files to compile.
Is your compass configuration correct?.
If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.
Running "watch" task
Waiting...

我的.scss文件存储在/myproject/sass//myproject/sass/bootstrap/

我希望.scss文件被编译成缩小的style.css文件。

我需要做什么来对此进行排序?

        compass: {
            dist: {
                options: {
                    sassDir: 'sass',
                    cssDir: 'css'
                }
            }
        },
        watch: {
            css: {
                files: '**/*.scss',
                tasks: ['compass']
            }
        }
    });
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-minified');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.registerTask('default',['concat', 'minified', 'uglify', 'compass', 'watch']);

这可能值得尝试:

watch: {
  sass: {
    files: '/sass/**/*.scss',
    tasks: ['default']
  },
},

我通过添加以下代码来修复它:

        compass: {
            compile: {
                options: {
                    cssDir: 'css'
                }
            }
        },

这将编译 css(不缩小)。 我还更改了文件和目录的其他几个值,所以我的 grunt 文件现在看起来像这样:

        compass: {
            dist: {
                options: {
                    sassDir: ['sass/**/*.scss', 'sass/*.scss'],
                    cssDir: 'css/style.css'
                }
            }
        },
        compass: {
            compile: {
                options: {
                    cssDir: 'css'
                }
            }
        },
        watch: {
            css: {
                files: ['sass/style.scss'],
                tasks: ['compass']
            }
        }

最新更新