簡體   English   中英

使用load-grunt-config找不到Grunt插件

[英]Grunt plugins not found using load-grunt-config

我將grunt插件分成了自己的文件,並使用load-grunt-config( https://github.com/firstandthird/load-grunt-config )來調用它們:

module.exports = function (grunt) {

  'use strict';

  require('load-grunt-config')(grunt);
}; 

我已經有了sass,autoprefixer,cssmin並觀看了工作,但是我還使用Browsersync和px-to-rem這兩個插件返回:

Warning: Task "remify" not found. Use --force to continue.

Warning: Task "browsersync" not found. Use --force to continue.

當單獨調用或作為較大任務的一部分調用時。

我已經遵循了這兩個插件的eparate.js文件的語法,所以我很茫然。 例如,運行grunt時調用的remify.js文件是這樣編寫的

module.exports = {
  dist: {
    options: {
      base: 16,
      fallback: true,
      fallback_existing_rem: true,
      ignore: []
    },
    files: {
      'css/style.css': 'css/style.css'
    }
  }
};

任何想法哪里出問題了?

我還設置了示例代碼的要點,包括package.json和aliases.yml

https://gist.github.com/sturobson/f88258fd010e901e24d9

您必須確切地稱呼grunt插件。 那么,我有remify我應該使用px_to_rem並在那里我有browsersync ,我應該有browserSync

傻我

您可以將第二個參數傳遞給load-grunt-config提供一些選項,您還可以在其中定義一些模式,這些模式可以由內部使用的load-grunt-tasks使用。

如果不傳遞第二個參數,它將使用load-grunt-tasks的默認模式grunt-*

因此,如果您想加載所有devDependencies而不單獨定義它們,請按照以下步驟操作:

require('load-grunt-config')(grunt, {
    loadGruntTasks: {
        pattern: '*',
        scope: 'devDependencies'
    }
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM