Skip to content
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

Add front end build to container #73

Merged
merged 2 commits into from
Mar 30, 2018
Merged

Conversation

jmaupetit
Copy link
Contributor

@jmaupetit jmaupetit commented Mar 29, 2018

Front-end JS and CSS builds were missing in Richie's container. This is now fixed.

@@ -6,7 +6,7 @@
"scripts": {
"build": "webpack",
"lint": "tslint -c tslint.json 'richie/js/**/*.ts'",
"sass": "node-sass richie/static/scss/_main.scss data/static/css/main.css",
"sass": "node-sass richie/static/scss/_main.scss richie/static/css/main.css",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbenadda I was wondering why we didn't put the result of the css build to richie/build instead of richie/static as it is the one in gitignore?

Copy link
Contributor Author

@jmaupetit jmaupetit Mar 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think richie/static/css is the right place for a css build, and, IMO, richie/build as no particular reason to exists, it should be removed and the build target should be richie/static/js... but that's another discussion I guess.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I can explain and then @mbenadda will need to add these explanations in the documentation because these design decisions are not obvious it's true.

The reason we need a /build folder separate from the /static folder is that the static folder is committed in the repo. The result of the build is not committed. So when you work on your project, you have a watch which rebuilds your css/js on which modification and you will easily make a mistake and commit the file results if they are not in a separate folder.

We could have made a specific folder inside /static folder but then:

  • this difference would transpire in our collected static folder which is not what we want,
  • it is clearer to have a /build directory and a best practice in frontend development,
  • mixing committed static files and build results is what is done in Open edX and I found it very confusing.

We then add the /build directory in the template finder so it is collected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add builds target directories (static/css + static/js) to your .gitignore, unless you really want it, you cannot commit the builds, and this is way more simpler than adding another static directory.

Plus, IMO, the richie/static/scss directory shouldn't be here, but rather in richie/assets/scss along with the js sources. I would find it way more cleaner/simpler this way. But that's only my opinion/habit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened a new issue to pursue this discussion, as it's off-topic here: see #74

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static/css + static/js to your .gitignore -> ok it's the same to me as what i proposed. So let's do it now because the css in static/css without gitignore like we have now is not good.

Styles build should be stored in the main static directory and then
copied via collectstatics where it will get served.
@jmaupetit jmaupetit force-pushed the add-front-end-build-to-container branch from 7c8ea72 to 299aa73 Compare March 30, 2018 05:38
@jmaupetit jmaupetit changed the title WIP: Add front end build to container Add front end build to container Mar 30, 2018
@jmaupetit jmaupetit removed the WIP label Mar 30, 2018
@@ -16,6 +16,7 @@ __pycache__/
# Site media
/data/
richie/build
richie/static/css

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then add also static/js I'm ok with this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 I think I'll do this in a new PR to address our conclusions from #74

@jmaupetit jmaupetit merged commit 6558e47 into master Mar 30, 2018
@jmaupetit jmaupetit deleted the add-front-end-build-to-container branch March 30, 2018 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants