Skip to content

feat(core): Add SCSS index file (fixes #2201) #2221

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

Merged
merged 46 commits into from
Nov 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
3e5a1ba
feat(core): Add SCSS index file
jacobmllr95 Nov 25, 2018
8a5e8d0
Make test and lint work again
jacobmllr95 Nov 25, 2018
921097b
Make docs happy again
jacobmllr95 Nov 25, 2018
14921ab
We only support IE 11
jacobmllr95 Nov 25, 2018
85fee52
Fix lint
jacobmllr95 Nov 25, 2018
74fa4da
update docs plugin
tmorehouse Nov 25, 2018
747b005
Update bootstrap-vue.js
tmorehouse Nov 25, 2018
57ea978
Update nuxt.config.js
tmorehouse Nov 25, 2018
ebec378
revert out css import in nuxt.config.js temporarily
tmorehouse Nov 25, 2018
4cb1041
Use SCSS index file for docs
jacobmllr95 Nov 25, 2018
ad5244d
Move import to plugin
jacobmllr95 Nov 25, 2018
b6fa8d1
Actually prefix css
jacobmllr95 Nov 25, 2018
9571704
Improve console output
jacobmllr95 Nov 25, 2018
4b953a9
Further improve build script
jacobmllr95 Nov 25, 2018
3f51f56
Update .eslintignore
tmorehouse Nov 25, 2018
e923031
create nuxt plugin template file
tmorehouse Nov 25, 2018
3ec7c05
Update .eslintignore
tmorehouse Nov 25, 2018
8c1bb6e
Rename nuxt/templates/plugin.js to nuxt/plugin.template.js
tmorehouse Nov 25, 2018
177352c
Update plugin.template.js
tmorehouse Nov 25, 2018
392f788
update nuxt module index.js
tmorehouse Nov 25, 2018
928b464
delete old plugin.js
tmorehouse Nov 25, 2018
57fdfd7
lint
tmorehouse Nov 25, 2018
b23b403
Update .eslintignore
tmorehouse Nov 25, 2018
10fd1d3
Update README.md
tmorehouse Nov 25, 2018
c47d30a
Update plugin.template.js
tmorehouse Nov 25, 2018
2e7f2c1
nuxt plugin module index.js use bootstrap.min.css
tmorehouse Nov 25, 2018
359bc70
nuxt.config.js: add babel polyfill and meta tag for IE 11 support
tmorehouse Nov 25, 2018
55c400e
Update README.md
tmorehouse Nov 26, 2018
15487b0
Update README.md
tmorehouse Nov 26, 2018
fd5e252
Update README.md
tmorehouse Nov 26, 2018
9e216ad
Update README.md
tmorehouse Nov 26, 2018
2be6830
_form-input.scss: use additional bootstrap variables
tmorehouse Nov 26, 2018
441c452
scss lint
tmorehouse Nov 26, 2018
a5f52b9
Update README.md
tmorehouse Nov 26, 2018
92c981a
Update README.md
tmorehouse Nov 26, 2018
95cc76c
Update nuxt.config.js
tmorehouse Nov 26, 2018
24e9373
Update nuxt.config.js
tmorehouse Nov 26, 2018
e2489d0
Update bootstrap-vue.js
tmorehouse Nov 26, 2018
02372d3
Update nuxt.config.js
tmorehouse Nov 26, 2018
b27b9f3
Update nuxt.config.js
tmorehouse Nov 26, 2018
158f998
Update bootstrap-vue.js
tmorehouse Nov 26, 2018
ba31624
Update index.scss
tmorehouse Nov 26, 2018
93336b8
Update nuxt.config.js
tmorehouse Nov 26, 2018
228e271
Update README.md
tmorehouse Nov 26, 2018
3d59ff0
Update README.md
tmorehouse Nov 26, 2018
256b75e
Update README.md
tmorehouse Nov 26, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .babelrc

This file was deleted.

13 changes: 13 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# https://github.com/browserslist/browserslist#readme

>= 1%
last 1 major version
not dead
Chrome >= 45
Firefox >= 38
Edge >= 12
Explorer >= 11
iOS >= 9
Safari >= 9
Android >= 4.4
Opera >= 30
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sw.js
play.js
/nuxt/plugin.template.js
36 changes: 14 additions & 22 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
'jest/globals': true
},
extends: [
'standard',
'plugin:vue/recommended'
],
plugins: [
'jest'
],
parserOptions: {
ecmaVersion: 8,
sourceType: "module"
},
globals: {
Tether: true,
Promise: true,
Vue: true
extends: ['standard', 'plugin:vue/recommended'],
plugins: ['jest'],
parserOptions: {
ecmaVersion: 8,
sourceType: 'module'
},
env: {
browser: true,
es6: true,
'jest/globals': true
},
globals: {
Vue: true
},
rules: {
"vue/attributes-order": 0
'vue/attributes-order': 'off'
}
}
9 changes: 9 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
presets: [['@babel/env', { useBuiltIns: 'entry' }]],
plugins: ['@babel/proposal-object-rest-spread', '@babel/transform-runtime'],
env: {
test: {
presets: [['@babel/env', { targets: { node: 8 } }]]
}
}
}
102 changes: 79 additions & 23 deletions docs/markdown/intro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,30 @@ import BootstrapVue from 'bootstrap-vue'
Vue.use(BootstrapVue);
```

And import Bootstrap and Bootstrap-Vue css files:
And import Bootstrap and Bootstrap-Vue *css* files:

```js
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
```
Or import Bootstrap and Bootstrap-Vue *scss* files via a custom SCSS file:
```css
// custom.scss
@import "node_modules/bootstrap/scss/bootstrap";
@import "node_modules/bootstrap-vue/src/index.scss";
```
```js
// App entry point
import 'custom.scss'
```
Be sure to include your custom variables before bootstrap.scss and include boostrap-vue
SCSS _after_ bootstrap SCSS to ensure variables are set up correctly

**Note**: _requires webpack configuration to load css files ([official guide](https://webpack.js.org/guides/asset-management/#loading-css))_
**Note**: _requires webpack configuration to load css/scss files
([official guide](https://webpack.js.org/guides/asset-management/#loading-css))_

## Nuxt.js

## Nuxt.js plugin module
Install dependencies:

```bash
Expand All @@ -43,18 +57,52 @@ yarn add bootstrap-vue

Add `bootstrap-vue/nuxt` to modules section of **nuxt.config.js**

This will include both `boostrap.css` and `bootstrap-vue.css` default CSS

```js
{
modules: [
'bootstrap-vue/nuxt',
modules: [ 'bootstrap-vue/nuxt' ]
}
```

If you are using custom bootstrap SCSS, you can disable automatic inclusion of Bootstrap
and Bootstrap-Vue pre-compiled CSS files by setting the folliwing option(s) to `false`:

// Or if you have custom bootstrap CSS...
['bootstrap-vue/nuxt', { css: false }],
```js
{
modules: [
['bootstrap-vue/nuxt', { bootstrapCss: false, bootstrapVueCss: false }],
]
}

```

## vue-cli
Bootstrap-Vue's custom CSS relies on some Boostrap SCSS variables. You can include Bootstrap
and Bootstrap-Vue SCSS in your project's custom SCSS file:

**custom.css file:**
```scss
// custom overrides go first
$grid-breakpoints: (
xs: 0,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px
foo: 1999px
);

// then include the following
@include "bootstrap/scss/bootstrap"
@include "bootstrap-vue/src/index.scss"
```
and in your app main entry point include the single custom scss file (wen using nodes-sass/sass-loader):
```js
import 'custom.scss'
```


## vue-cli V2

Bootstrap-Vue has two vue-cli templates available:

Expand All @@ -77,8 +125,12 @@ npm run dev
You can repeat the commands above replacing `bootstrap-vue/webpack-simple` with
`bootstrap-vue/webpack` for the webpack template.

## Individual components and directives
## vue-cli V3

Coming soon!


## Individual components and directives
If you would like to only pull in a specific component or set of components, you can do
this by directly importing those components.

Expand Down Expand Up @@ -114,11 +166,14 @@ Vue and ES2015 allow for various syntaxes here, so feel free to utilize kebab-ca
camel-casing, pascal-casing, and/or object property shorthand.

### Component groups and Directives as Vue plugins

You can also import component groups and directives as Vue plugins by importing
the component group or directive directory:

```js
// This imports all the layout components such as <b-container>, <b-row>, <b-col>:
import { Layout } from 'bootstrap-vue/es/components';
Vue.use(Layout);

// This imports <b-modal> as well as the v-b-modal directive as a plugin:
import { Modal } from 'bootstrap-vue/es/components';
Vue.use(Modal);
Expand All @@ -134,12 +189,12 @@ Vue.use(Scrollspy);

When importing as plugins, all subcomponents and related directives are imported in most cases.
i.e. When importing `<b-nav>`, all the `<nav-*>` sub components are also included, as well all
dropdown sub components.
dropdown sub components. Component shorthand aliases (if any) are also included in the plugin.

Refer to the component and directive documentation for details.

### Webpack + Babel

### Webpack + Babel
When importing components/directives individually, you must configure your app to properly
build the bootstrap-vue library source code. This commonly involves white-listing the node
module for your babel loader rule in webpack.
Expand Down Expand Up @@ -169,28 +224,31 @@ module.exports = {
}
```

## Browser

## Browser
```html
<!-- Add this to <head> -->
<link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap/dist/css/bootstrap.min.css"/>
<link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.css"/>
<link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.min.css"/>

<!-- Add this after vue.js -->
<script src="//unpkg.com/babel-polyfill@latest/dist/polyfill.min.js"></script>
<script src="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.js"></script>
<script src="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.min.js"></script>
```


## Build variants

Choosing the best variant for your build environment / packager helps less bundle sizes.
If your bundler supports es modules, it will automatically prefer it over commonjs.

| Variant | Environments | Package path
| -------------- | -------------------- | -----------------------------------
| **ES Module** | Webpack 2 / Rollup | `dist/bootstrap-vue.esm.js`
| commonjs2 | Webpack 1 / ... | `dist/bootstrap-vue.common.js`
| UMD | Browser | `dist/bootstrap-vue.js`
| -------------- | -------------------- | -------------------------------------------------------------
| **ES Module** | Webpack 2 / Rollup | `es/index.js`
| **ESM Module** | Webpack 2 / Rollup | `dist/bootstrap-vue.esm.js` _or_ `dist/bootstrap-vue.esm.min.js`
| commonjs2 | Webpack 1 / ... | `dist/bootstrap-vue.common.js` _or_ `dist/bootstrap-vue.common.min.js`
| UMD | Browser | `dist/bootstrap-vue.js` _or_ `dist/bootstrap-vue.min.js`


## Migrating a project already using Bootstrap

Expand All @@ -200,31 +258,29 @@ If you've already been using Bootstrap 4, there are a couple adjustments you may
- If Bootstrap is the only thing relying on jQuery, you can safely remove it — BootstrapVue **does not** depend on jQuery
- Convert your native bootstrap HTML markup into the simplified Bootstrap-Vue custom component markup


## Browsers Support

### CSS

BootstrapVue is to be used with Bootstrap 4 CSS.
Please see [Browsers and devices](https://getbootstrap.com/docs/4.0/getting-started/browsers-devices)
for more information about browsers currently supported by Bootstrap 4.

### JS

BootstrapVue is written in Vue! So this is up to your project and bundler which browsers are supported.
If you want to support older IE, Android and IOS devices, you may want to use
[Babel Polyfill](https://babeljs.io/docs/usage/polyfill)

### IE 11

You'll need babel-polyfill for BootstrapVue to work properly. In order to support this browser:

- `npm install babel-polyfill`
- Import it in your app main entry point with `import 'babel-polyfill'`


## Tooling Support

### vscode + vetur

If you are using [vscode](https://code.visualstudio.com/) as your text editor, bootstrap-vue
has intellisense autocompletion for component attributes available when using the
[vetur extension](https://marketplace.visualstudio.com/items?itemName=octref.vetur).
Expand Down
43 changes: 38 additions & 5 deletions docs/markdown/reference/theming/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
# Theming Bootstrap
# Theming Bootstrap & Bootstrap-Vue

Theming is accomplished by Sass variables, Sass maps, and custom CSS. There’s no dedicated
theme stylesheet; instead, you can enable the built-in theme to add gradients, shadows, and more.

While Bootstrap-Vue uses Bootstrap's CSS, cetain features of Bootstrap-Vue uses custom CSS (i.e.
stacked tables, etc). Our custom CSS relies on variables defined the Bootstrap V4.x SCSS. The
`bootstrap-vue.css` is compiled using the default Bootstrap V4.x variables. Using the
Bootstrap-Vue source SCSS, you can have your variable overrides (such as breakpoints, etc) adjust
the custom Bootstrap-Vue css.

## Custom SCSS
To use your own theme and colors in `bootstrap-vue`, you will need to create a
`_custom.scss` file in your project, which you can include in your main app:
`custom.scss` file in your project, which you can include in your main app:

**Via template:**
```html
<style lang="scss">

@import "assets/_custom.scss";
@import "assets/custom.scss";
@import "~bootstrap/scss/bootstrap.scss";
@import '~bootstrap-vue/dist/bootstrap-vue.css';
@import '~bootstrap-vue/src/index.scss';

body {
margin: 0;
Expand All @@ -22,6 +27,32 @@ To use your own theme and colors in `bootstrap-vue`, you will need to create a
</style>
```

**Via app main entry point:**

Create an SCSS file such as `custom.scss`
```css
// Define your variable overrides here
$enable-shadows: true;
$enable-gradients: true;
$grid-breakpoints: (
xs: 0,
sm: 428px,
md: 799px,
lg: 899px,
xl: 1234px
xxl: 1600px
);

// include Bootstrap and Bootstrap-Vue SCSS files
@import "~bootstrap/scss/bootstrap.scss";
@import '~bootstrap-vue/src/index.scss';
```
and then import that single SCSS file into your app code entry point:
```js
// app.js
import "custom.scss";
```

The `_custom.scss` file, which needs to be loaded before Bootstrap's scss, will include your
Bootstrap V4 variable overrides (i.e. colors, shadows, font sizes, breakpoints, etc).
You can find all of the possible variables in `node_modules/bootstrap/scss/_variables.scss`.
Expand All @@ -32,6 +63,8 @@ Do not forget to include `node-sass` and `sass-loader` to use `scss` in Vue:
npm install --save-dev node-sass sass-loader
```

**Note:** You may need to adjust the SCSS import paths based on your build environment.


## See also
For more details on theming Bootstrap's CSS, refer to the
Expand Down
Loading