stephenplusplus/grunt-wiredep

Access to bower_components at top level directory

Closed this issue · 3 comments

Hi There,
I have problem with accessing bower_components folder from my app folder, as its at upper level of my app folder, this is my structure:

Project
---bower_components
---app
---scr

so my server sets to go to app folder as main directory, so I access my index like:
project/index.html

now as bower_components folder is outside of app folder, I cant access to it and it throws this error:

Not Found: The requested URL /bower_components/bootstrap/dist/css/bootstrap.css was not found on this server.

could you please help me to set settings in wiredep to access that?
thanks so much.

Sorry this took me so long to reply. Where is your server making bower_components available? You will just have to instruct wiredep where that is by using either ignorePath or a fileType.replace function https://github.com/taptapship/wiredep/#configuration

Realize this is not really a grunt-wiredep problem as its only simply in the middle of injecting URL references to your HTML/CSS, it can't go any further. Grunt or the next grunt task (Example: usemin) has to figure out how to determine where the source files really are.

As stephenplusplus mentioned: Include in your 'Gruntfile.js' file to ignore ..\ from the beginning of the html/css files, as for the fileType.replace. that seems just a little more corky and not really a solution but i guess helps in certain situations.

project/Gruntfile.js:

grunt.initConfig({
...
wiredep: {
            app: {
                ignorePath: /^\/|\.\.\//,
                src: ['src/index.html']
            }
        },
...
    });

Another solution may be changing your project/bower_components folder location to project/src/bower_components.

project/.bowerrc :

{
  "directory": "src/bower_components",
  "dependencies": true,
  "devDependencies": true
}

The sooner this is ironed out the better, i wouldn't recommend doing this in the middle of a project as the Gruntfile can grow and scrolling up and down all day to replace source destinations can be a pain in the A**.

-Null

Feel free to re-open if there's something else we can help with.