question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading only what you need in bootstrap

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [X] feature request

Versions.

@angular/cli: 1.3.0 node: 8.3.0 os: win32 x64

Repro steps.

npm install bootstrap-loader npm install --save-dev bootstrap@v4.0.0-alpha.6

Node SASS & other loaders needed to handle styles npm install --save-dev css-loader node-sass resolve-url-loader sass-loader style-loader url-loader npm install --save-dev imports-loader exports-loader postcss-loader

The log given by the failure.

ERROR in C:/Data/programs/angular-cli/src/main.ts (11,1): Cannot find name 'require'.
ERROR in C:/Data/programs/angular-cli/src/main.ts (11,1): Cannot find name 'require'.
ERROR in ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/resolve-url-loader!./node_modules/sass-loader/lib/loader.js?sourceMap!./node_modules/bootstrap-loader/l
ib/bootstrap.styles.loader.js?{"bootstrapVersion":4,"useFlexbox":false,"extractStyles":false,"styleLoaders":["style","css","postcss","sass"],"styles":["mixins","normalize","print","button
s","code","forms","grid","images","carousel","modal","popover","tooltip","utilities"],"scripts":[],"configFilePath":"C://Data//programs//angular-cli//.bootstraprc","bootstrapPath":"C://Da
ta//programs//angular-cli//node_modules//bootstrap","bootstrapRelPath":"..//bootstrap"}!./node_modules/bootstrap-loader/no-op.js
Module build failed: Error: No PostCSS Config found in: C:\Data\programs\angular-cli\node_modules\bootstrap-loader
    at C:\Data\programs\angular-cli\node_modules\postcss-load-config\index.js:51:26
    at <anonymous>
 @ ./node_modules/style-loader!./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/resolve-url-loader!./node_modules/sass-loader/lib/loader.js?sourceMap!./node_modu
les/bootstrap-loader/lib/bootstrap.styles.loader.js?{"bootstrapVersion":4,"useFlexbox":false,"extractStyles":false,"styleLoaders":["style","css","postcss","sass"],"styles":["mixins","norm
alize","print","buttons","code","forms","grid","images","carousel","modal","popover","tooltip","utilities"],"scripts":[],"configFilePath":"C://Data//programs//angular-cli//.bootstraprc","
bootstrapPath":"C://Data//programs//angular-cli//node_modules//bootstrap","bootstrapRelPath":"..//bootstrap"}!./node_modules/bootstrap-loader/no-op.js 4:14-704
 @ ./node_modules/bootstrap-loader/lib/bootstrap.loader.js!./node_modules/bootstrap-loader/no-op.js
 @ ./node_modules/bootstrap-loader/loader.js
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

Desired functionality.

I´m trying to load just what I need in Bootstrap 4 and using the bootstrap-loader

Mention any other details that might be useful.

bootstrap-loader

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
JSMikecommented, Aug 11, 2017

in src/styles.scss

@import '~bootstrap/scss/mixins';
@import '~bootstrap/scss/utilities/flex';
@import '~bootstrap/scss/bootstrap-grid';
@import '~bootstrap/scss/card';
...

I’d look at ngx-bootstrap or ng-bootstrap for adding JavaScript functionality, I wouldn’t suggest adding jQuery to an Angular project. There are plenty of articles out there on how to, but just don’t do it.

1reaction
JSMikecommented, Aug 11, 2017

fyi, look at node_modules/bootstrap/scss/bootstrap.scss to see the order in which the sass files are pulled in, so you get all of the variables in the right order.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spinners
Bootstrap “spinners” can be used to show the loading state in your projects. They're built only with HTML and CSS, meaning you don't...
Read more >
Separately loading in Bootstrap components
Bootstrap has a modular structure and the idea behind is you only have to load (or compile) what you need. Compiling your own...
Read more >
The Ultimate Guide to Bootstrap CSS
The good news is you'll only need a basic knowledge of coding to get started. ... You're now ready to load Bootstrap CSS...
Read more >
Loading Bootstrap 3's JavaScript Components With ...
Using RequireJS to only load the Boostrap 3 JavaScript components you want.
Read more >
10 Most Common Bootstrap Mistakes That Developers Make
Always make sure that the modal container and its parent elements don't have any special positioning applied. The best practice is to place...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found