Base solution for your next web application
Open Closed

Styles not applied to *.Web.Public pages. #6692


User avatar
0
timmackey created

Version: 6.8.0 ASP.NET Core & Angular

Download and build the project. Unmodified. Styles do not appear to be applied. Browser console message: "Refused to apply style from '<URL>' because its MIME type ('') is not a supported stylesheet MIME type, and strict MIME checking is enabled." No errors is log file. "Bundle & Minifier" and "Web Compiler" extensions are installed. cd to folder "*.Web.Public" and ran "npm run create-bundles" from command line. (Don't know how to "run Web Compiler" per #6527) Please advise.


11 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    try run npm run create-bundles in Web.Public folder.

  • User Avatar
    0
    timmackey created

    running npm run create-bundles in Web.Public folder is the solution. Thank you.

  • User Avatar
    0
    timmackey created

    Same problem as above in version 7.0.0.

    running npm run create-bundles in Web.Public folder does not resolve the isssue.

  • User Avatar
    0
    maliming created
    Support Team

    I have not reproduced your problem with V7. You can download the Zero Demo v7 project to see if the same problem exists.

  • User Avatar
    0
    timmackey created

    Ok. It seems to be working now. Not sure what I did to get it working.

    Notice that npm run create-bundles never finishes, though.

    The cmd prompt does not appear unless ctrl-C is used to terminate the batch job.

  • User Avatar
    0
    maliming created
    Support Team

    @timmackey

    Notice that npm run create-bundles never finishes, though.

    You can remove the --watch parameter

    "create-bundles": "webpack --progress --profile --watch --mode=development"

  • User Avatar
    0
    timmackey created

    The first time I ran npm run create-bundles without the --watch parameter it exited the batch job normally. However when I tried to recompile is Visual Studio, the Output window displayed the following message:

    Build delayed until Bower/npm packages finish restoring.

    Closing the cmd window had no effect. I had to restart Visual Studio to be able to compile again. .Web.Public executed normally. Subsequent attempts to run num run create-bundles results in the following error:

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @timmackey

    "npm run create-bundles" is designed for development time. So, when you run it, it watches your css and js files and updated the bundles automatically.

    For production, you need use "npm run build" command which exists after creating the bundles.

  • User Avatar
    0
    timmackey created

    Same problem in Version 8.0.0 for unmodified downloaded project. In VS on project ngTTM.Web.Public, from context menu select 'Bundle & Minifier', click 'Update bundles'. Ran "npm run create-bundles" (multiple times) in Web.Public folder.

  • User Avatar
    0
    maliming created
    Support Team

    Same problem in Version 8.0.0 for unmodified downloaded project.

    In v8.0 we no longer use Bundle & Minifier.

    please try:

    npm run create-bundles
    npm run build
    

    package.json

    "scripts": {
         "create-bundles": "gulp buildDev",
         "build": "gulp build"
      }
    
  • User Avatar
    0
    timmackey created

    @maliming - Your suggetion worked.