-
Notifications
You must be signed in to change notification settings - Fork 725
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
[RFR] Better integration with module bundlers #959
Conversation
## Bootstraping your Admin | ||
|
||
Just add a `<div ui-view>` into your HTML, add a `ng-app` attribute on your `body`, and configure the admin: | ||
ithu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems I missed an ALT + TAB
. To delete.
With the help of @RobinBressan, switching to RFR. @djhi, meanwhile, can you try using this branch on your project? I heard you got some troubles building an admin app in production with master version of ng-admin. It should fix your issue. |
Hello, I am actually in the process of using the ng-admin-only way because I needed to add ngCookies to my app. Anyway, does this branch means that it will be solved by simply adding a require(ng-admin) in the js loaded by our webpack build, as well as to ngCookies. And will simply be able to declare the module when initializing the module ?
If so, I will put my refactor on the backboiler for now, and wont submit my changes for the production documentation :) Thanks |
@Phocea: unfortunately for your changes, this is indeed the aim of this PR. :) |
|
||
``` js | ||
// SASS version | ||
require('ng-admin/sass/ng-admin.scss'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/ng-admin/sass/ng-admin.scss/ng-admin/src/sass/ng-admin.scss
To sum up a private discussion with @djhi:
|
@jpetitcolas great :) Well this is great news really because the old way was really painful and as you stated, the production.md page was impossible to maintain. |
Hello @jpetitcolas , any update on when this is going to be merged on the main branch? No rush, but it would sort out the mess I had to implement :) |
@Phocea you're right, this PR definitively needs some love. I take back a look on it. :) |
Merci Monsieur ! |
640811d
to
c0f0e57
Compare
``` | ||
|
||
Using a module bundler, you would also be able to generate the source map for all your JavaScript | ||
and stylesheets, helping you to hunt even the most pernicious bugs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/pernicious/obscure/
As requested by @fzaninotto at #959 (comment)
|
||
### Without a Module Bundler | ||
|
||
If you don't have a module bundler, don't worry: you can still embed `ng-admin` the old way: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/embed ng-admin
the old way/include ng-admin
with a <script>
tag/
As requested by @fzaninotto at #959 (comment)
@@ -9,6 +9,8 @@ Let's use the REST API offered by [JSONPlaceholder](http://jsonplaceholder.typic | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should revert the changes on this one, to let newcomers begin with the simplest version (<script>
tag)
…cript>` tag/ As requested by @fzaninotto at #959 (comment)
|
||
## Removing `ng-admin-only` build | ||
|
||
We used to build two versions of `ng-admin`: a standalone one and a `only` one. The latter includes only files required to ng-admin. But it was a little buggy and required a lot of dependencies. Including a functional version of this only version was so painful we decided to abandon it in profit of a better bundler integration (see previous paragraph). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/this only version/this '-only' version/ s/painful we/painful that we/
Code review applied. |
\o/ |
+1 .... here we go, more work for me to come ;) |
@Phocea: good point: we forget that. Need to work on it. However, if you speak of Poster Galore, here is the related PR: marmelab/ng-admin-demo#26 |
@jpetitcolas Yeap meant the poster galore demo . Sorry more work for you too then :) |
Hello @jpetitcolas, I have started to use your refactor in our own webpack build and went through a bit of trouble :) 1.
The only way for webpack to find the ng-admin module is to either give a path relative to the javascript this is required from, or add an alias in webpack.config like so (for example):
Might be something to add to the documentation ? 2.
In the end I have managed to have a it wokring with the following resolve section in my webpack config:
and ng-admin vendor.js modified to look like:
Does this sound acceptable ? |
lol .. was just about to say that I have a bit of css problem now ! |
package.json
to point on correct files