Search code examples
javascriptjquerycssconcrete5

Accessing path in javascript (concrete5)


I am building a template for concrete5. The problem I am facing is that I have to access the css path from a javascript file. The plugin which has to do this uses:

breakpoints: {
        'global': { range: '*', href: '/css/style.css', containers: 0, grid: { gutters: 0 } }
    }

The file I am trying to access is located at

domain.com/application/themes/test/css/style.css

and not at

domain.com/css/stlye.css

Kinda stuck with my beginner javascript skills at this point. The console gives me the error 404 for the file. Makes sense since the style.css file is not located where I am searching it..

The js file is located at:

domain.com/application/themes/test/js/init.js

How can I access the style.css file?


Solution

  • I believe using the path below should work.

      /application/themes/test/css/style.css
    

    placing the / in front of the url will make the browser look in the main folder first. That is why you were getting "domain.com/css/stlye.css" when you placed the url "/css/style.css" in your object.

    So I would try the following changes to your object to see if it works:

     breakpoints: {
        'global': { range: '*', href: '/application/themes/test/css/style.css', containers: 0, grid: { gutters: 0 } }
    }