【问题标题】:UNCSS keeps aborting with "src files were empty" messageUNCSS 不断中止并显示“src 文件为空”消息
【发布时间】:2016-08-09 20:03:29
【问题描述】:

我不断收到 UNCSS 的此错误:'Warning: Destination (dist/css/main.css) not written because src files were empty. Use --force to contine. Aborted due to warnings.

我相信它可以正常运行任务并且设置正确。我可以将 grunt 用于其他事情。

在 gruntfile.js 中,我包含:grunt.loadNpmTasks('grunt-uncss'); 和

  uncss: {
    dist: {
        files: {
          'dist/css/main2.css': ['../index.html']                                           
        }
    }
  }

我不确定出了什么问题,但我认为是路径问题,但事实就是如此。我也在使用 SCSS,所以也许它需要一个原始 css 作为SRC?我已经尝试在没有 Grunt 的情况下重新安装 PhantomJS 和原始 UNCSS,但我无处可去!有什么想法吗?

【问题讨论】:

    标签: gruntjs uncss


    【解决方案1】:

    我找到了解决方案。 不一定是路径,而是路径的呈现方式。

    我正在使用

      files: {
          'dist/css/main2.css': ['../index.html']                                           
      }
    

    我换了

     files: [       
          { src: 'index.html', dest: 'dist/css/main.css' }
     ]
    

    这里声明了src 和dest。

    这个博客帮助了我deanhume.com。 github/NPM 文档对我不起作用,但这个人对我有用。我希望这对某人有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-02
      • 1970-01-01
      • 1970-01-01
      • 2010-12-17
      • 1970-01-01
      相关资源
      最近更新 更多