0

So, Im confused with the use of the new "magic' wwwroot folder. I get the concept, it's a placeholder for all things "content" to be served to the client. But when it comes to bundle/minify/ect it seems to do more harm than good. Since the 'wwwroot' folder is an actual folder, it has a path. But, you never referenced it like you would any other folder. So, when trying to request content from a URL I would say "http://myURL/images/imgone.img" but the image is inside the wwwroot/images folder. However, when I need to bundle I have to specify the folder. then, during minification it add the "wwwroot" to the reference inside CSS. I feel like im stuck in a circle here.

How has anyone dealt with this new "magic" folder from MS?

UPDATE: I have an old site, using DurandalJS, which in turn uses RequireJS. I have a gulp task (gulp-durandal) that bundles the JS files (My APP files and Durandal) into one single JS file. I use the bundle-minifier plug in to handle bundling the rest of the JS files (3rd party, ect). Problem is, inside the main.js file might look like this.

require.config({
catchError: {
    define: true
},
waitSeconds: 200,
urlArgs: "v=" + (new Date()).getTime(),
paths: {
    //text: "../Scripts/lib/require/text",
    durandal: "../Scripts/lib/durandal/js",
    plugins: "../Scripts/lib/durandal/js/plugins",
    transitions: "../Scripts/lib/durandal/js/transitions",
    async: "../Scripts/lib/require/async",
    services: "services",

}

});

but if the scripts folder is located inside the "wwwroot" folder, it cannot be found. But I cannot specify the folder directly, because then when running development and requesting each file, it will try and bring it down from http://myURL/wwwroot/scripts/ect

7
  • 1
    How are you bundling? There's no magic here, it's all documented.
    – DavidG
    Commented Feb 20, 2018 at 15:15
  • What exactly is your question? To me it sounds more like asking for opinions, which is well... off-topic on StackOverflow
    – Tseng
    Commented Feb 20, 2018 at 15:26
  • Updated the question. I would like to know how others using aspnet core are dealing with the wwwroot folder as it pertains to bundling and minifying. Maybe someone who has used requirejs can also chim in. This new folder appears on the file system as a folder, but for the purpose of the URL, its invisible. And that is causing issues.
    – JCircio
    Commented Feb 20, 2018 at 15:28
  • You're supposed to use <script src="~/lib/durandal/js/bundle.js /> in razor. ~ always defines the application relative pathes
    – Tseng
    Commented Feb 20, 2018 at 15:29
  • Thats the main.js. Not razor.. heres the entire piece
    – JCircio
    Commented Feb 20, 2018 at 16:14

1 Answer 1

1

The folder wwwroot is for your client historically called "static content". You can rename wwwroot if you would like. Nowadays it is kind of logical separation between the app's client-side content and server-based code (which should not be inside wwwroot to prevent server-side code from being leaked.

2
  • 1
    Thank you Dmitry.
    – JCircio
    Commented Feb 20, 2018 at 16:39
  • @JCircio you're welcome! Feel free to mark it as an answer if it answers your question. Commented Feb 21, 2018 at 11:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.