Skip to content

Commit

Permalink
docs(documentation): update readme and bootstrap.md files
Browse files Browse the repository at this point in the history
  • Loading branch information
svetoldo4444ka committed Mar 13, 2018
1 parent 65d0475 commit ab44cde
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 64 deletions.
65 changes: 44 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,51 @@ Best way to quickly integrate <a href="https://getbootstrap.com/">Bootstrap 3</a
4. [API](#api)
5. [Troubleshooting](#troubleshooting)
6. [Contributing](#contribution)
7. [License](#license)

# Getting Started
## Getting Started

ngx-bootstrap contains all core (and not only) Bootstrap components powered by Angular. So you don't need to include original JS components, but we are using markup and css provided by Bootstrap.

# Installation instructions
## Installation instructions

Install `ngx-bootstrap` from `npm`
Install `ngx-bootstrap` from `npm`:
```bash
npm install ngx-bootstrap --save
```

You will need bootstrap styles (Bootstrap 3)
Add needed package to NgModule imports:
```
import { TooltipModule } from 'ngx-bootstrap/tooltip';
@NgModule({
...
imports: [TooltipModule.forRoot(),...]
...
})
```

Add component to your page:
```
<button type="button" class="btn btn-primary"
tooltip="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
Simple demo
</button>
```

You will need bootstrap styles:
- `Bootstrap 3`
```
<!-- index.html -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
```

Or Bootstrap 4
- `Bootstrap 4`
```
<!--- index.html -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
```
To enable bootstrap 4 theme templates in ngx-bootstrap, please read
[this](https://github.com/valor-software/ngx-bootstrap/blob/development/docs/getting-started/bootstrap4.md) .

# Usage & Demo
## Usage & Demo

Main source of API documentation and usage scenarios available here:
[https://valor-software.com/ngx-bootstrap/](https://valor-software.com/ngx-bootstrap/)
Expand All @@ -73,36 +89,39 @@ Additionally you can find demos and docs deployed from latest code with <a href=

Server side rendered version of this documentation available <a href="https://ngx-universal.herokuapp.com/">here</a>

# API
## API
Check demo page for API [reference](https://valor-software.com/ngx-bootstrap/)

## How to use it with:
- `angular-cli` please refer to [getting-started-with-ng-cli](https://github.com/valor-software/ngx-bootstrap/tree/development/docs/getting-started/ng-cli.md)
### How to use it with:
- `Bootstrap 3 or 4 and angular-cli` please refer to [using-with-bootstrap-and-angular-cli](https://github.com/valor-software/ngx-bootstrap/tree/development/docs/getting-started/bootstrap.md)
- `angular-seed` please refer to [getting-started-with-angular-seed](https://github.com/valor-software/ngx-bootstrap/tree/development/docs/getting-started/angular-seed.md)
- `system.js` (and [angular2 quickstart](https://angular.io/docs/ts/latest/quickstart.html)) please checkout [sample repository](https://github.com/valor-software/angular2-quickstart)
- `plnkr` sample available [here](http://bit.ly/ngx-bootstrap-plnkr)
- `plnkr` sample available [here](https://plnkr.co/edit/0NipkZrnckZZROAcnjzB?p=preview)
- `AoT using ngc and rollup` please refer to [ngx-bootstrap-with-aot](https://github.com/valor-software/ngx-bootstrap/tree/development/docs/getting-started/aot.md)
- `Bootstrap 4 and angular-cli` please refer to [using-with-bootstrap-4-and-angular-cli](https://github.com/valor-software/ngx-bootstrap/tree/development/docs/getting-started/bootstrap4.md)
- `ASP.NET Core 2.0` please refer to [using-with-asp.net-core-2](https://github.com/csegyud/ASPNETCore_ngx-bootstrap_Sample/blob/master/README.md)

# How to build lib for development
### How to build lib for development

First time
First time:
- clone repository
- `npm install`
- `npm run test` it will build the lib and create a link in `node_modules`

Keeping a fork up to date:
- git pull upstream development
- `npm run test`

To run bootstrap 3 and 4 demo:
- `npm run demo.serve` to serve local demo. This is for testing only, without watchers.

For local development run
For local development run:
- `npm run build.watch` in first terminal
- `ng serve` in second

If you want to run the demo with Angular Universal:
- `npm run demo.serve-universal`

# Troubleshooting
## Troubleshooting

So if you are in trouble, here's where you can look for help.

Expand All @@ -111,16 +130,20 @@ You can also join [our Slack channel](https://ngx-slack.herokuapp.com/) and link

If, **and only if**, none of the above helped, please open a [new issue](https://github.com/valor-software/ngx-bootstrap/issues/new).

# Contribution
## Contribution

Are very welcome! And remember, contribution is not only PRs and code, but any help with docs or helping other developers to solve issues are very appreciated! Thanks in advance!

Please read our [contribution guidelines](https://github.com/valor-software/ngx-bootstrap/blob/development/CONTRIBUTING.md).

## If you need more modules check [here](https://github.com/valor-software/ng2-plans)
### If you need more modules check [here](https://github.com/valor-software/ng2-plans)

Please read central `ngx` modules [readme](https://github.com/valor-software/ng2-plans) for details, plans and approach

## Credits
### Credits
Crossbrowser testing sponsored by [Browser Stack](https://www.browserstack.com)
[<img src="https://camo.githubusercontent.com/a7b268f2785656ab3ca7b1cbb1633ee5affceb8f/68747470733a2f2f64677a6f7139623561736a67312e636c6f756466726f6e742e6e65742f70726f64756374696f6e2f696d616765732f6c61796f75742f6c6f676f2d6865616465722e706e67" alt="Browser Stack" height="31px" style="background: cornflowerblue;">](https://www.browserstack.com)

### License

MIT
Original file line number Diff line number Diff line change
@@ -1,58 +1,68 @@
## Using with Bootstrap 4 with angular-cli
# Using with Bootstrap and angular-cli

This is extracted from the [angular-cli include bootstrap story](https://github.com/angular/angular-cli/wiki/stories-include-bootstrap) and demonstates one way to accomplish using Bootstrap 4 with ngx-bootstrap.
This is extracted from the [angular-cli include bootstrap story](https://github.com/angular/angular-cli/wiki/stories-include-bootstrap) and demonstates one way to accomplish using Bootstrap 3 or 4 with ngx-bootstrap. The `Bootstrap's` version is defined automatically by the `ngx-bootstrap`.

The important thing to note is the final section - you must let ngx-bootstrap know you are using Bootstrap 4 as it assumes BS3 by default.

#### Installing angular-cli
## Installing angular-cli

*Important*: please check `angular-cli` version, it should be => "1.5.0"
*Important*: please check `angular-cli` version, it should be latest stable.

*Note*: You can skip this part if you already have application generated by `ng-cli` and webpack.

```bash
npm i -g @angular/cli
ng new my-app
cd my-app
ng serve
```

#### Adding ngx-bootstrap and Bootstrap 4
- install `ngx-bootstrap` and `Bootstrap 4`
## Adding ngx-bootstrap and Bootstrap

- install `ngx-bootstrap` and `Bootstrap`

```bash
npm install ngx-bootstrap bootstrap --save
npm install ngx-bootstrap bootstrap --save
```

### Using with css
#### Configuring Project

Now that the project is set up it must be configured to include the Bootstrap CSS.
## Using with css
### Configuring Project

- Open the file .angular-cli.json from the root of your project.
- Under the property apps the first item in that array is the default application.
- There is a property styles which allows external global styles to be applied to your application.
Now that the project is set up it must be configured to include the Bootstrap CSS. You have two options:

- Specify the path to bootstrap.min.css
- add styles to .angular-cli.json:
- Open the file .angular-cli.json from the root of your project.
- Under the property apps the first item in that array is the default application.
- There is a property styles which allows external global styles to be applied to your application.

It should look like the following when you are done:
```
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
- Specify the path to bootstrap.min.css

It should look like the following when you are done:
```
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
],
```
Note: When you make changes to .angular-cli.json you will need to re-start ng serve to pick up configuration changes.
```

Note: When you make changes to .angular-cli.json you will need to re-start ng serve to pick up configuration changes.

- add styles to index.html:
- for Bootstrap 3:
```
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
```

- or for Bootstrap 4:
```
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
```

### Using SASS
## Using SASS

#### Configuring Project
### Configuring Project

Ensure that the project is set up to use scss by default and that the main styles file is styles.scss

The easiest way to do this is when creating a new project by
The easiest way to do this is when creating a new project by
```bash
ng new my-app --style=scss
cd my-app
Expand All @@ -63,27 +73,26 @@ If the project has already been created then
- rename `src/styles.css` to `src/styles.scss`
- in `.angular-cli.json` make the following changes
```
"styles": [
"styles.scss" <-- rename this from .css to .scss
],
.
.
.
"defaults": {
"styleExt": "scss", <-- set this to default to .scss
"component": {}
}
"styles": [
"styles.css" <-- rename this from .css to .scss
],
.
.
.
"defaults": {
"styleExt": "css" <-- set this to default to .scss
}
```
Create an empty file `_variables.scss` in `src/`.

In `styles.scss` add the following:

```
@import 'variables';
@import 'variables';
@import '../node_modules/bootstrap/scss/bootstrap';
```

### Testing
## Checkout

Open `src/app/app.module.ts` and add

Expand All @@ -94,7 +103,7 @@ import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
@NgModule({
...
imports: [BsDropdownModule.forRoot(), ... ],
...
...
})
```

Expand Down

0 comments on commit ab44cde

Please sign in to comment.