willsters
willsters

Reputation: 151

Adding angular module to mean.io package

I am trying to add the angular-ui-grid module from npm (or bower) to a mean.io package:

$ cd packages/custom/mypackage
$ npm install angular-ui-grid --save

I then added this line to to packages/custom/mypackage/public/index.js

import 'angular-ui-grid';

and this line to packages/custom/mypackage/app.js

MyPackage.angularDependencies(['ui.grid']);

This seems to import the JS, but not the CSS. How do I get it to also bring in the styles?

Upvotes: 0

Views: 130

Answers (3)

willsters
willsters

Reputation: 151

This works:

packages/custom/mypackage/public/index.js

import '../node_modules/angular-ui-grid/ui-grid.min.css';

but seems hacky.

Is there something missing from the angular-ui-grid package definition that denotes the main css file or is it an issue with mean.io's build system?

Upvotes: 0

Andriy
Andriy

Reputation: 15442

just add into your index.js:

import 'angular-ui-grid/ui-grid.min.css';

you can see how it is done for angular-ui-select in the mean.io's app.js:

https://github.com/linnovate/mean/blob/05c63abae72635923eda07fefeac937b4e67790e/app.js

Upvotes: 1

Muli Yulzary
Muli Yulzary

Reputation: 2569

Link the css file(s) in index.html

Example:

//index.html
<html ng-app>
<head>    
<link rel="stylesheet" type="text/css" href="node_modules/angular-ui-grid/ui-grid.min.css">
</head>
...
</html>

Source

Upvotes: 0

Related Questions