Comments (4)
Currently I cannot imagine a solution which is pretty.
But I'll have an idea, that it'll need some minor changes in webpack.
in SpecificViewX.js
var JadeView = require("./JadeView?" + __dirname);
in JadeView.js
var template = require(__resourceQuery + "/template/" + this.name + ".jade");
The change would be to evaluate __dirname and __resourceQuery as compile time constant.
A problem would be that the code of JadeView.js
would be duplicated for each directory with SpecificViews.
from enhanced-require.
Interesting, I also had that idea of evaluating __dirname
and the like at compile time, but thought that would be too much of a hassle for even mentioning. Plus, you're right, even then I'd have to have a JadeView
(or at least a subtype of it with that specific template loading part) in each of my project view root directories since it's still relative to that directory. I guess it's best, in that case, to let each SpecificView
load the template on its own, i.e. just duplicate that template loading part. When I am going to move the JadeView
type out of my projects in a separate package, then relative path snippets won't do anymore, unfortunately, since you never know where the files would be. On the other hand, I could barely still call it JadeView
when it doesn't take care of the template loading, couldn't I :)
Thanks for your suggestions, though! Maybe I'll think about that some more later and let you know, if I have some major enlightenment.
Edit: Having a second look at the JadeView
stub, would it really need to be replicated? if __resourceQuery
contained the absolute directory path, then it should be just fine.
from enhanced-require.
I made the changes to webpack... webpack/webpack@2183f05
Now here is my idea: https://github.com/sokra/resourceQuery-example
from enhanced-require.
Horrific! I can't wait to give it a try. Thanks a lot!
from enhanced-require.
Related Issues (14)
- Issue loading jade templates HOT 2
- Node fibers throw an error when used with enhanced require
- module.paths API is missing
- Updates required to get this up-to-date
- SyntaxError: Unexpected token ILLEGAL with java node_module HOT 1
- If this lib is CURRENTLY UNMAINTAINED, then what I should do to use webpack client side files in node.js? HOT 9
- The code for "startup your application" makes very little sense.
- doesn't support emitFile HOT 4
- Define loaders in options HOT 2
- Mocha node testing with enhanced requires HOT 3
- Amd module with return doesn't get populated on node.js HOT 1
- Add a global var named __webpack_public_path__ in order to play nice with other loaders (file-loader) HOT 2
- Resolver plugin not working HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enhanced-require.