Grunt,TypeError:对象没有方法'拆分'

Grunt, TypeError: Object has no method 'Split'

本文关键字:拆分 有方法 TypeError 对象 Grunt      更新时间:2023-09-26

我是第一次建立Grunt,一切都很顺利(使用Chris Coyier的24 Ways文章:http://24ways.org/2013/grunt-is-not-weird-and-hard/)。

想想看,我偏离了常规,遇到了问题。我安装了cssmin来缩小我已经连接的CSS,我得到了:

Running "cssmin:combine" (cssmin) task
>> TypeError: Object behavior:__ESCAPED_EXPRESSION_CLEAN_CSS0_ has no method 'split'
Warning: css minification failed. Use --force to continue.
Aborted due to warnings.

使用--force也失败(警告:css缩小失败。)

我能够毫无问题地安装、配置和使用concat、uglify和imagemin。以下是我的简化咕哝文件,试图隔离问题:

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        cssmin: {
            combine: {
                files: {
                    'resources/css/build/site.prod.test.css': ['resources/css/libs/*.css', 'resources/css/*.css']
                }
            }
        }
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask('default', ['cssmin']);

我也尝试过使用文档中的特定示例,但无论我尝试哪一个,我都会得到相同的"拆分"错误:

https://github.com/gruntjs/grunt-contrib-cssmin

感谢您的帮助!

我删除了CSS文件,直到我找到了导致问题的原因。一切都恢复正常了,所以问题实际上归结为CSS问题,而不是Javascript问题。

希望这能帮助其他人。