modularity

How to structure a express.js application?

你离开我真会死。 提交于 2019-11-27 05:45:59
Is there a common convention for breaking up and modularizing the app.js file in an Express.js application? Or is it common to keep everything in a single file? Chance I have mine broken up as follows: ~/app |~controllers | |-monkey.js | |-zoo.js |~models | |-monkey.js | |-zoo.js |~views | |~zoos | |-new.jade | |-_form.jade |~test | |~controllers | |-zoo.js | |~models | |-zoo.js |-index.js I use Exports to return what's relevant. For instance, in the models I do: module.exports = mongoose.model('PhoneNumber', PhoneNumberSchema); and then if I need to create a phone number, it's as simple as:

How can one import only variables and mixins from Sass stylesheets?

百般思念 提交于 2019-11-26 21:04:29
I'm using the Zurb Foundation 4 (S)CSS framework, and I'm running into an issue of massively duplicated styles. This is because in every file that I @import 'foundation' in, all styles from Foundation are also imported (rules for body , .row , .button and friends). This leads to long SCSS compile times and a hard to navigate web developer console in Chrome, as all of Zurb's styles are declared four or five times. To mitigate this, I've created a globals scss file, which contains the overrideable variables that Foundation uses (it's copy-pasted from foundation_and_overrides.scss , then

How to use 3rd party library in Java9 module?

有些话、适合烂在心里 提交于 2019-11-26 14:08:22
问题 I have some java9 module that uses 3rd party library that is not Java9 module, just a simple utility jar. However, the compiler complains that it can't find a package from my utility. What should I do in module-info.java to enable usage of my 3rd party library? 回答1: You can use your library as an automatic module . An automatic module is a module that doesn't have a module descriptor (i.e. module-info.class ). But what name should you use to refer to this module? The name of the automatic

Splitting up shared code and web.xml from WAR project to common JAR project

梦想的初衷 提交于 2019-11-26 13:55:03
问题 I have different webapps that share a large portion of the web.xml configuration. For example, the way some servlets are mapped is identical for all apps, but some webapps have custom servlets, or an additional filter, or shared managed beans. Each webapp is a different project in my IDE. I would like to refactor the common part of my web.xml to a "common" project, and let all the application-specific web.xml's extend the "common" web.xml. Is there any possibility to do this? 回答1: Yes, you

How to structure a express.js application?

微笑、不失礼 提交于 2019-11-26 11:44:42
问题 Is there a common convention for breaking up and modularizing the app.js file in an Express.js application? Or is it common to keep everything in a single file? 回答1: I have mine broken up as follows: ~/app |~controllers | |-monkey.js | |-zoo.js |~models | |-monkey.js | |-zoo.js |~views | |~zoos | |-new.jade | |-_form.jade |~test | |~controllers | |-zoo.js | |~models | |-zoo.js |-index.js I use Exports to return what's relevant. For instance, in the models I do: module.exports = mongoose.model

Packaging Facelets files (templates, includes, composites) in a JAR

拥有回忆 提交于 2019-11-26 11:17:26
Is it possible to put JSF2 Facelets files with common content into a JAR to use it from other web applications inside e.g. <ui:composition template> , <ui:include src> , <cc:implementation> , etc? If yes, how can I achieve this? Is some extra configuration necessary? You can put common resources in the /META-INF/resources folder of the JAR which is to be treated like as /WEB-INF/resources folder of the WAR. E.g. CommonWebProject |-- META-INF | |-- resources | | `-- common | | |-- css | | | `-- some.css | | |-- js | | | `-- some.js | | |-- images | | | `-- some.png | | |-- components | | | `--

How can one import only variables and mixins from Sass stylesheets?

允我心安 提交于 2019-11-26 07:47:51
问题 I\'m using the Zurb Foundation 4 (S)CSS framework, and I\'m running into an issue of massively duplicated styles. This is because in every file that I @import \'foundation\' in, all styles from Foundation are also imported (rules for body , .row , .button and friends). This leads to long SCSS compile times and a hard to navigate web developer console in Chrome, as all of Zurb\'s styles are declared four or five times. To mitigate this, I\'ve created a globals scss file, which contains the

Packaging Facelets files (templates, includes, composites) in a JAR

丶灬走出姿态 提交于 2019-11-26 01:58:58
问题 Is it possible to put JSF2 Facelets files with common content into a JAR to use it from other web applications inside e.g. <ui:composition template> , <ui:include src> , <cc:implementation> , etc? If yes, how can I achieve this? Is some extra configuration necessary? 回答1: You can put common resources in the /META-INF/resources folder of the JAR which is to be treated like as /WEB-INF/resources folder of the WAR. E.g. CommonWebProject |-- META-INF | |-- resources | | `-- common | | |-- css | |