Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to include bootstrap styles (bootstrap.min.css) #1220

Closed
jScope opened this issue Nov 28, 2016 · 4 comments
Closed

how to include bootstrap styles (bootstrap.min.css) #1220

jScope opened this issue Nov 28, 2016 · 4 comments

Comments

@jScope
Copy link

jScope commented Nov 28, 2016

Hey,

I'm currently struggling when I try to migrate my project into your webpack-starter. Most things work okay but I need bootstrap classes from bootstrap.min.css.

Currently I`ve got the following in my webpack.common.js:

module: {
rules: [
{
test: /.(woff2?|ttf|eot|svg)$/,
use: 'file-loader'
},
{
test: /.css$/,
use: ['to-string-loader', 'css-loader']
}
]
}

In my main.browser.ts I currently have:

import './assets/css/bootstrap/css/bootstrap.min.css';
import './assets/css/styles.css';

but I'm not sure if I have to do a require here instead but both doesn't work for me. I get no error message but the bootstrap grid system is not available when I run localhost:3000.

Any help would be very appreciated.

@diegochavez
Copy link
Contributor

Hi @jScope,

You should looks in to this issue #696 some folks added solutions to this problem, instead of adding your own bootstrap on assets folder you can install with npm,

Best,

@jScope
Copy link
Author

jScope commented Nov 29, 2016

Thank you @diegochavez!

I already know about this solution. I was just asking myself if there is a way to only include the "bootstrap.min.css" because I just use bootstrap grid structure and other css classes. I don`t really need bootstrap.min.js or even jQuery, which increase the size of my application.

@jScope
Copy link
Author

jScope commented Nov 29, 2016

Today I gave it another try and firts re-installed the css-loader with

npm install css-loader --save-dev

In my main.browser.ts I required my bootstrap.min.css
require('./assets/css/bootstrap/css/bootstrap.min.css');

I also changed the rule for css files to

{
test: /.css$/,
use: ['style-loader', 'css-loader']
}

Don't know what exactly did the trick but for me it's okay at this point.

@jScope jScope closed this as completed Nov 29, 2016
@psks1204
Copy link

to use bootstrap and learn how to create new component
watch this video hope it helps!

https://youtu.be/lt0hAoUES2s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants