GithubHelp home page GithubHelp logo

Comments (4)

sokra avatar sokra commented on April 25, 2024

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.

miffels avatar miffels commented on April 25, 2024

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.

sokra avatar sokra commented on April 25, 2024

I made the changes to webpack... webpack/webpack@2183f05

Now here is my idea: https://github.com/sokra/resourceQuery-example

from enhanced-require.

miffels avatar miffels commented on April 25, 2024

Horrific! I can't wait to give it a try. Thanks a lot!

from enhanced-require.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.