如何获得早午餐和早餐;sass早午餐是否要编译/包含bootstrap.scss?

如何获得早午餐和早餐;sass早午餐是否要编译/包含bootstrap.scss?,sass,brunch,twitter-bootstrap-4,bootstrap-4,Sass,Brunch,Twitter Bootstrap 4,Bootstrap 4,我不熟悉早午餐,但在尝试将sass早午餐和bootstrap-4.0.0-alpha.2设置为npm安装的模块时,我无法将其包括bootstrap.scss。你知道我做错了什么吗 这是一个例子 My package.json: { "name": "simple-brunch", "version": "0.1.0", "private": true, "devDependencies": { "bootstrap": "^4.0.0-alpha.2", "bru

我不熟悉早午餐,但在尝试将sass早午餐和bootstrap-4.0.0-alpha.2设置为npm安装的模块时,我无法将其包括bootstrap.scss。你知道我做错了什么吗

这是一个例子

My package.json:

{
  "name": "simple-brunch",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "bootstrap": "^4.0.0-alpha.2",
    "brunch": "^2.5.3",
    "javascript-brunch": "^2.0.0",
    "sass-brunch": "^2.0.0"
  }
}
我的早午餐-config.js:

module.exports = {
  config: {
    files: {
      javascripts: {
        joinTo: {
          'vendor.js': /^(?!app)/,
          'app.js': /^app/
        }
      },
      stylesheets: {
        joinTo: {
          'vendor.css': /^(?!app)/,
          'app.css': /^app/
        }
      }
    },

    npm: {
      styles: {
        bootstrap: ['scss/bootstrap.scss']
      }
    }
  }
}
brunch build-d
的输出如下所示
sass早午餐
已成功用于处理
app/styles/main.scss
——有一行
brunch:pipeline
显示了它。然而,尽管顶部附近的几行似乎表明它已找到并编译了bootstrap的
bootstrap.scss
,底部附近的
brunch:generate
行似乎表明它已连接到
vendor.css
,但该文件是空的,除了指向
vendor.css.map
/*#sourceMappingURL=vendor.css.map*/
),该映射只包含
{“版本”:3,“源”:[],“名称”:[],“映射”:“文件”:“public/vendor.css”}

我尝试过但不起作用的事情:

  • plugins.sass.options.includePath:['node_modules/bootstrap/scss']
    设置添加到brunch-config.js;输出没有变化

  • 在brunch-config.js中添加
    paths.watched:['app','test','vendor','node_modules/bootstrap/scss']
    设置——它现在似乎可以找到并查看该目录中的所有文件,但仍然没有通过brunch管道将bootstrap.scs发送到sass brunch可能有漏洞的地方

以下是输出:

brunch:config Trying to load brunch-config +0ms
brunch:plugins Loaded plugins: javascript-brunch, sass-brunch +66ms
brunch:watch add package.json +16ms
brunch:watch add brunch-config.js +0ms
brunch:watch add /Users/stearns/brunch-starter/node_modules/bootstrap/scss/bootstrap.scss +1ms
brunch:list Reading node_modules/bootstrap/scss/bootstrap.scss +0ms
brunch:file Init node_modules/bootstrap/scss/bootstrap.scss: isntModule=true isWrapped=false +3ms
brunch:list Compiled node_modules/bootstrap/scss/bootstrap.scss +6ms
brunch:watch add app/application.js +1ms
brunch:list Reading app/application.js +0ms
brunch:file Init app/application.js: isntModule=false isWrapped=true +1ms
brunch:pipeline Compiling app/application.js @ JavaScriptCompiler +1ms
brunch:watch add app/assets/index.html +17ms
brunch:asset Init app/assets/index.html directory=app/assets/ relativePath=index.html destinationPath=public/index.html +1ms
brunch:watch add app/styles/main.scss +1ms
brunch:list Reading app/styles/main.scss +0ms
brunch:asset Copied app/assets/index.html +7ms
brunch:file Init app/styles/main.scss: isntModule=false isWrapped=false +1ms
brunch:pipeline Compiling app/styles/main.scss @ SassCompiler +0ms
brunch:pipeline Dependencies app/styles/main.scss @ SassCompiler +4ms
brunch:list Compiled app/styles/main.scss +0ms
brunch:list Reading node_modules/bootstrap/dist/js/npm.js +6ms
brunch:modules Wrapping application.js @ commonjs +0ms
brunch:list Compiled app/application.js +1ms
brunch:file Init node_modules/bootstrap/dist/js/npm.js: isntModule=true isWrapped=true +0ms
brunch:list Reading node_modules/bootstrap/dist/js/umd/util.js +33ms
brunch:list Reading node_modules/bootstrap/dist/js/umd/alert.js +0ms
brunch:list Reading node_modules/bootstrap/dist/js/umd/button.js +0ms
brunch:list Reading node_modules/bootstrap/dist/js/umd/carousel.js +0ms
brunch:list Reading node_modules/bootstrap/dist/js/umd/collapse.js +0ms
brunch:list Reading node_modules/bootstrap/dist/js/umd/dropdown.js +0ms
brunch:list Reading node_modules/bootstrap/dist/js/umd/modal.js +0ms
brunch:list Reading node_modules/bootstrap/dist/js/umd/scrollspy.js +0ms
brunch:list Reading node_modules/bootstrap/dist/js/umd/tab.js +1ms
brunch:list Reading node_modules/bootstrap/dist/js/umd/tooltip.js +0ms
brunch:list Reading node_modules/bootstrap/dist/js/umd/popover.js +0ms
brunch:modules Not wrapping (is vendor file) node_modules/bootstrap/dist/js/npm.js +0ms
brunch:list Compiled node_modules/bootstrap/dist/js/npm.js +0ms
brunch:file Init node_modules/bootstrap/dist/js/umd/util.js: isntModule=true isWrapped=true +1ms
brunch:file Init node_modules/bootstrap/dist/js/umd/alert.js: isntModule=true isWrapped=true +0ms
brunch:file Init node_modules/bootstrap/dist/js/umd/button.js: isntModule=true isWrapped=true +0ms
brunch:file Init node_modules/bootstrap/dist/js/umd/carousel.js: isntModule=true isWrapped=true +1ms
brunch:file Init node_modules/bootstrap/dist/js/umd/collapse.js: isntModule=true isWrapped=true +0ms
brunch:file Init node_modules/bootstrap/dist/js/umd/dropdown.js: isntModule=true isWrapped=true +0ms
brunch:file Init node_modules/bootstrap/dist/js/umd/modal.js: isntModule=true isWrapped=true +0ms
brunch:file Init node_modules/bootstrap/dist/js/umd/scrollspy.js: isntModule=true isWrapped=true +1ms
brunch:file Init node_modules/bootstrap/dist/js/umd/tab.js: isntModule=true isWrapped=true +0ms
brunch:file Init node_modules/bootstrap/dist/js/umd/tooltip.js: isntModule=true isWrapped=true +0ms
brunch:file Init node_modules/bootstrap/dist/js/umd/popover.js: isntModule=true isWrapped=true +1ms
brunch:modules Not wrapping (is vendor file) node_modules/bootstrap/dist/js/umd/util.js +18ms
brunch:list Compiled node_modules/bootstrap/dist/js/umd/util.js +2ms
brunch:modules Not wrapping (is vendor file) node_modules/bootstrap/dist/js/umd/button.js +18ms
brunch:list Compiled node_modules/bootstrap/dist/js/umd/button.js +0ms
brunch:modules Not wrapping (is vendor file) node_modules/bootstrap/dist/js/umd/alert.js +54ms
brunch:list Compiled node_modules/bootstrap/dist/js/umd/alert.js +1ms
brunch:modules Not wrapping (is vendor file) node_modules/bootstrap/dist/js/umd/carousel.js +2ms
brunch:list Compiled node_modules/bootstrap/dist/js/umd/carousel.js +1ms
brunch:modules Not wrapping (is vendor file) node_modules/bootstrap/dist/js/umd/collapse.js +2ms
brunch:list Compiled node_modules/bootstrap/dist/js/umd/collapse.js +0ms
brunch:modules Not wrapping (is vendor file) node_modules/bootstrap/dist/js/umd/dropdown.js +2ms
brunch:list Compiled node_modules/bootstrap/dist/js/umd/dropdown.js +0ms
brunch:modules Not wrapping (is vendor file) node_modules/bootstrap/dist/js/umd/modal.js +2ms
brunch:list Compiled node_modules/bootstrap/dist/js/umd/modal.js +1ms
brunch:modules Not wrapping (is vendor file) node_modules/bootstrap/dist/js/umd/scrollspy.js +2ms
brunch:list Compiled node_modules/bootstrap/dist/js/umd/scrollspy.js +4ms
brunch:modules Not wrapping (is vendor file) node_modules/bootstrap/dist/js/umd/tab.js +2ms
brunch:list Compiled node_modules/bootstrap/dist/js/umd/tab.js +1ms
brunch:modules Not wrapping (is vendor file) node_modules/bootstrap/dist/js/umd/tooltip.js +1ms
brunch:list Compiled node_modules/bootstrap/dist/js/umd/tooltip.js +1ms
brunch:modules Not wrapping (is vendor file) node_modules/bootstrap/dist/js/umd/popover.js +1ms
brunch:list Compiled node_modules/bootstrap/dist/js/umd/popover.js +1ms
brunch:write Writing 4/4 files +69ms
brunch:generate Concatenating [node_modules/bootstrap/scss/bootstrap.scss] => public/vendor.css +2ms
brunch:generate Concatenating [app/application.js] => public/app.js +2ms
brunch:generate Concatenating [app/styles/main.scss] => public/app.css +2ms
brunch:generate Concatenating [node_modules/bootstrap/dist/js/npm.js, node_modules/bootstrap/dist/js/umd/alert.js, node_modules/bootstrap/dist/js/umd/button.js, node_modules/bootstrap/dist/js/umd/carousel.js, node_modules/bootstrap/dist/js/umd/collapse.js, node_modules/bootstrap/dist/js/umd/dropdown.js, node_modules/bootstrap/dist/js/umd/modal.js, node_modules/bootstrap/dist/js/umd/popover.js, node_modules/bootstrap/dist/js/umd/scrollspy.js, node_modules/bootstrap/dist/js/umd/tab.js, node_modules/bootstrap/dist/js/umd/tooltip.js, node_modules/bootstrap/dist/js/umd/util.js] => public/vendor.js +3ms
brunch:common Writing public/vendor.css +33ms
brunch:common Writing public/app.js +0ms
brunch:common Writing public/app.css +0ms
brunch:common Writing public/vendor.js +1ms
brunch:common Writing public/app.css.map +4ms
brunch:common Writing public/app.js.map +1ms
brunch:common Writing public/vendor.css.map +0ms
brunch:common Writing public/vendor.js.map +8ms
27 Mar 03:52:23 - info: compiled 15 files into 4 files, copied index.html in 776ms

npm.style
只能用于添加来自
node\u模块的编译CSS
。在这种情况下,如果不想自定义引导,可以使用

npm: {
  styles: {
    bootstrap: ['dist/css/bootstrap.css']
  }
}
或者,要使用其sass版本(自定义它等等),您需要:

  • plugins.sass.options.includePath=['node\u modules/bootstrap/scss']
    ,正如您所尝试的那样。这只是将引导添加到sass的加载路径
  • 实际上,
    @import'bootstrap'
    在您的SASS文件中。否则,SASS如何知道它是否应该包括该文件,以及应该包括在哪里

  • 注意,在本例中,您将有一个大的css文件作为输出(app.css)

    请参阅:开始一个问题我想问你关于iThanks的任何问题,@bass——这是一个框架,可以将bootstrap4构建到我的应用程序的源代码中;我更喜欢将bootstrap4作为一个独立的依赖项来维护,以便于以后升级。对于第一个选项,请确保你安装了
    css早午餐
    遇到了类似的问题npm选项中的样式没有被引入。只是想提一下,如果你错过了CSS的包名或路径,你将不会得到任何警告。至少我没有,这让我花费了一些宝贵的时间。