Skip to content

Commit de504fb

Browse files
Wei Wangwesleycho
Wei Wang
authored andcommittedMar 26, 2016
feat: add support for loading without CSS
- Add support for loading components without bringing along the CSS, which is necessary for SystemJS/JSPM users Closes angular-ui#5696
1 parent daf3b2e commit de504fb

File tree

16 files changed

+102
-80
lines changed

16 files changed

+102
-80
lines changed
 

‎README.md

+23-4
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ Do you want to see directives in action? Visit http://angular-ui.github.io/boots
3131

3232
# Angular 2
3333

34-
Are you interested in Angular 2? We are on our way! Check out [ng-bootstrap](https://github.com/ui-bootstrap/core).
34+
Are you interested in Angular 2? We are on our way! Check out [ng-bootstrap](https://github.com/ui-bootstrap/core).
3535

3636
# Installation
3737

3838
Installation is easy as UI Bootstrap has minimal dependencies - only the AngularJS and Twitter Bootstrap's CSS are required.
39-
*Notes:*
39+
*Notes:*
4040
* Since version 0.13.0, UI Bootstrap depends on [ngAnimate](https://docs.angularjs.org/api/ngAnimate) for transitions and animations, such as the accordion, carousel, etc. Include `ngAnimate` in the module dependencies for your app in order to enable animation.
4141
* UI Bootstrap depends on [ngTouch](https://docs.angularjs.org/api/ngTouch) for swipe actions. Include `ngTouch` in the module dependencies for your app in order to enable swiping.
4242

@@ -89,9 +89,10 @@ When you are done downloading all the dependencies and project files the only re
8989
angular.module('myModule', ['ui.bootstrap']);
9090
```
9191

92-
# Webpack
92+
# Webpack / JSPM
9393

94-
To use this project with webpack, follow the [NPM](#install-with-npm) instructions. Now, if you want to use only the accordion, you can do:
94+
To use this project with webpack, follow the [NPM](#install-with-npm) instructions.
95+
Now, if you want to use only the accordion, you can do:
9596

9697
```js
9798
import accordion from 'angular-ui-bootstrap/src/accordion';
@@ -112,6 +113,24 @@ This will load all the dependencies (if any) and also the templates (if any).
112113

113114
Be sure to have a loader able to process `css` files like `css-loader`.
114115

116+
If you would prefer not to load your css through your JavaScript file loader/bundler, you can choose to import the `index-nocss.js` file instead, which is available for the modules:
117+
* carousel
118+
* datepicker
119+
* datepickerPopup
120+
* position
121+
* timepicker
122+
* tooltip
123+
* typeahead
124+
125+
The other modules, such as `accordion` in the example below, do not have CSS resources to load, so you should continue to import them as normal:
126+
127+
```js
128+
import accordion from 'angular-ui-bootstrap/src/accordion';
129+
import typeahead from 'angular-ui-bootstrap/src/typeahead/index-nocss.js';
130+
131+
angular.module('myModule', [accordion, datepicker]);
132+
```
133+
115134
# Support
116135

117136
## FAQ

‎karma.conf.js

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = function(config) {
2828
// list of files to exclude
2929
exclude: [
3030
'src/**/index.js',
31+
'src/**/index-nocss.js',
3132
'src/**/docs/*'
3233
],
3334

‎src/carousel/index-nocss.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require('../../template/carousel/carousel.html.js');
2+
require('../../template/carousel/slide.html.js');
3+
require('./carousel');
4+
5+
var MODULE_NAME = 'ui.bootstrap.module.carousel';
6+
7+
angular.module(MODULE_NAME, ['ui.bootstrap.carousel', 'uib/template/carousel/carousel.html', 'uib/template/carousel/slide.html']);
8+
9+
module.exports = MODULE_NAME;

‎src/carousel/index.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,2 @@
1-
require('../../template/carousel/carousel.html.js');
2-
require('../../template/carousel/slide.html.js');
3-
require('./carousel');
4-
51
require('./carousel.css');
6-
7-
var MODULE_NAME = 'ui.bootstrap.module.carousel';
8-
9-
angular.module(MODULE_NAME, ['ui.bootstrap.carousel', 'uib/template/carousel/carousel.html', 'uib/template/carousel/slide.html']);
10-
11-
module.exports = MODULE_NAME;
2+
module.exports = require('./index-nocss.js');

‎src/datepicker/index-nocss.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require('../dateparser');
2+
require('../isClass');
3+
require('../../template/datepicker/datepicker.html.js');
4+
require('../../template/datepicker/day.html.js');
5+
require('../../template/datepicker/month.html.js');
6+
require('../../template/datepicker/year.html.js');
7+
require('./datepicker');
8+
9+
var MODULE_NAME = 'ui.bootstrap.module.datepicker';
10+
11+
angular.module(MODULE_NAME, ['ui.bootstrap.datepicker', 'uib/template/datepicker/datepicker.html', 'uib/template/datepicker/day.html', 'uib/template/datepicker/month.html', 'uib/template/datepicker/year.html']);
12+
13+
module.exports = MODULE_NAME;

‎src/datepicker/index.js

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,2 @@
1-
require('../dateparser');
2-
require('../isClass');
3-
require('../../template/datepicker/datepicker.html.js');
4-
require('../../template/datepicker/day.html.js');
5-
require('../../template/datepicker/month.html.js');
6-
require('../../template/datepicker/year.html.js');
7-
require('./datepicker');
8-
91
require('./datepicker.css');
10-
11-
var MODULE_NAME = 'ui.bootstrap.module.datepicker';
12-
13-
angular.module(MODULE_NAME, ['ui.bootstrap.datepicker', 'uib/template/datepicker/datepicker.html', 'uib/template/datepicker/day.html', 'uib/template/datepicker/month.html', 'uib/template/datepicker/year.html']);
14-
15-
module.exports = MODULE_NAME;
2+
module.exports = require('./index-nocss.js');

‎src/datepickerPopup/index-nocss.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require('../datepicker');
2+
require('../position');
3+
require('../../template/datepickerPopup/popup.html.js');
4+
5+
var MODULE_NAME = 'ui.bootstrap.module.datepickerPopup';
6+
7+
angular.module(MODULE_NAME, ['ui.bootstrap.datepickerPopup', 'uib/template/datepickerPopup/popup.html']);
8+
9+
module.exports = MODULE_NAME;

‎src/datepickerPopup/index.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,2 @@
1-
require('../datepicker');
2-
require('../position');
3-
require('../../template/datepickerPopup/popup.html.js');
4-
51
require('./popup.css');
6-
7-
var MODULE_NAME = 'ui.bootstrap.module.datepickerPopup';
8-
9-
angular.module(MODULE_NAME, ['ui.bootstrap.datepickerPopup', 'uib/template/datepickerPopup/popup.html']);
10-
11-
module.exports = MODULE_NAME;
2+
module.exports = require('./index-nocss.js');

‎src/position/index-nocss.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require('./position');
2+
3+
var MODULE_NAME = 'ui.bootstrap.module.position';
4+
5+
angular.module(MODULE_NAME, ['ui.bootstrap.position']);
6+
7+
module.exports = MODULE_NAME;

‎src/position/index.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
require('./position');
2-
31
require('./position.css');
4-
5-
var MODULE_NAME = 'ui.bootstrap.module.position';
6-
7-
angular.module(MODULE_NAME, ['ui.bootstrap.position']);
8-
9-
module.exports = MODULE_NAME;
2+
module.exports = require('./index-nocss.js');

‎src/timepicker/index-nocss.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require('../../template/timepicker/timepicker.html.js');
2+
require('./timepicker');
3+
4+
require('./timepicker.css');
5+
6+
var MODULE_NAME = 'ui.bootstrap.module.timepicker';
7+
8+
angular.module(MODULE_NAME, ['ui.bootstrap.timepicker', 'uib/template/timepicker/timepicker.html']);
9+
10+
module.exports = MODULE_NAME;

‎src/timepicker/index.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
require('../../template/timepicker/timepicker.html.js');
2-
require('./timepicker');
3-
41
require('./timepicker.css');
5-
6-
var MODULE_NAME = 'ui.bootstrap.module.timepicker';
7-
8-
angular.module(MODULE_NAME, ['ui.bootstrap.timepicker', 'uib/template/timepicker/timepicker.html']);
9-
10-
module.exports = MODULE_NAME;
2+
module.exports = require('./index-nocss.js');

‎src/tooltip/index-nocss.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
require('../position');
2+
require('../stackedMap');
3+
require('../../template/tooltip/tooltip-popup.html.js');
4+
require('../../template/tooltip/tooltip-html-popup.html.js');
5+
require('../../template/tooltip/tooltip-template-popup.html.js');
6+
require('./tooltip');
7+
8+
var MODULE_NAME = 'ui.bootstrap.module.tooltip';
9+
10+
angular.module(MODULE_NAME, ['ui.bootstrap.tooltip', 'uib/template/tooltip/tooltip-popup.html', 'uib/template/tooltip/tooltip-html-popup.html', 'uib/template/tooltip/tooltip-template-popup.html']);
11+
12+
module.exports = MODULE_NAME;

‎src/tooltip/index.js

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,2 @@
1-
require('../position');
2-
require('../stackedMap');
3-
require('../../template/tooltip/tooltip-popup.html.js');
4-
require('../../template/tooltip/tooltip-html-popup.html.js');
5-
require('../../template/tooltip/tooltip-template-popup.html.js');
6-
require('./tooltip');
7-
81
require('./tooltip.css');
9-
10-
var MODULE_NAME = 'ui.bootstrap.module.tooltip';
11-
12-
angular.module(MODULE_NAME, ['ui.bootstrap.tooltip', 'uib/template/tooltip/tooltip-popup.html', 'uib/template/tooltip/tooltip-html-popup.html', 'uib/template/tooltip/tooltip-template-popup.html']);
13-
14-
module.exports = MODULE_NAME;
2+
module.exports = require('./index-nocss.js');

‎src/typeahead/index-nocss.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require('../debounce');
2+
require('../position');
3+
require('../../template/typeahead/typeahead-match.html.js');
4+
require('../../template/typeahead/typeahead-popup.html.js');
5+
require('./typeahead');
6+
7+
var MODULE_NAME = 'ui.bootstrap.module.typeahead';
8+
9+
angular.module(MODULE_NAME, ['ui.bootstrap.typeahead', 'uib/template/typeahead/typeahead-match.html', 'uib/template/typeahead/typeahead-popup.html']);
10+
11+
module.exports = MODULE_NAME;

‎src/typeahead/index.js

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,2 @@
1-
require('../debounce');
2-
require('../position');
3-
require('../../template/typeahead/typeahead-match.html.js');
4-
require('../../template/typeahead/typeahead-popup.html.js');
5-
require('./typeahead');
6-
71
require('./typeahead.css');
8-
9-
var MODULE_NAME = 'ui.bootstrap.module.typeahead';
10-
11-
angular.module(MODULE_NAME, ['ui.bootstrap.typeahead', 'uib/template/typeahead/typeahead-match.html', 'uib/template/typeahead/typeahead-popup.html']);
12-
13-
module.exports = MODULE_NAME;
2+
module.exports = require('./index-nocss.js');

0 commit comments

Comments
 (0)
Please sign in to comment.