Base solution for your next web application
Open Closed

Issue with npm run create-bundles on a Mac #7638


User avatar
0
cmthomps created

Just downloaded a new 7.1 Core MVC/jquery project and having an issue with the create-bundles script on my Mac. For some reason, some URLs are getting replaced by the full UNC local path on my machine. It doesn't seem to happen on a Windows box that I have. Here is an example of what is happening:

In core.less there is the following:

/* Social Login Icons */
.kt-login__options form a i.fa-openidconnect {
    background: url(../Images/Social/openid.png) no-repeat;
    width: 16px;
    height: 16px;
}

After running npm run create-bundles, I get the following in common-styles.min.css:

/* Social Login Icons */
.kt-login__options form a i.fa-openidconnect {
  background: url(/dist/img//Users/cthompson/Projects/SmcProject/SmcServerProject/src/Smc.SmcProject.Web.Mvc/wwwroot/Common/Images/Social/openid.png) no-repeat;
  width: 16px;
  height: 16px;
}

I get similar results whereever the "url(" function is used in css. Thoughts?

Thanks, Craig


3 Answer(s)
  • User Avatar
    0
    cmthomps created

    Ok. So I figured out what the issue is. I'm not sure if there is a way to make this line of code conditional based on the operating system.

    On line 191 of gulpfile.js, there is this line of code:

     var fileName = asset.absolutePath.substring(asset.absolutePath.lastIndexOf('\\') + 1);
    

    My issue is resolved if I change it to this (notice the difference in back slashes vs forward slashes):

    var fileName = asset.absolutePath.substring(asset.absolutePath.lastIndexOf('/') + 1);
    
  • User Avatar
    0
    cmthomps created

    I think the solution is to use:

    var fileName = path.basename(asset.absolutePath);
    

    This makes it work on both windows and mac.

    Craig

  • User Avatar
    0
    yekalkan created