0

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?

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

That's what I was looking for. I've spent most of the day being annoyed at the outdated docs/tutorials.
0

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

2 Comments

That does not work as the node_modules directory does not exist in the build output. MEAN.io packages up assets into the bundle as part of the build.
This is just an example. you'll have to locate the angular-ui-grid lib folder and include that file in your index.html
0

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?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.