1

I have the following problem:

I am trying add routes js files in php. In a html file works perfectly.

Why not work in a php file?

Try:

grunt bower-install 

Error:

Verifying property bower-install.app.src exists in config...OK Reading bower.json...OK Parsing bower.json...OK Warning: Cannot read property 'block' of undefined Use --force to continue. 

The code:

bower: { dev: { dest: './components' }, }, 'bower-install': { app: { src: ['template.php'] }, }, } 

There is a issue since a week ago, but no response there. https://github.com/stephenplusplus/grunt-bower-install/issues/33

3
  • You should open an issue on the related Github repository after checking this issue is not already reported. Commented Jan 3, 2014 at 22:52
  • @SimonBoudrias there are a issue in github.com/stephenplusplus/grunt-bower-install/issues/33 Commented Jan 3, 2014 at 22:55
  • Doesn't seems so bad. Looks like wiredep is looking at file extension and just don't process .php. It should be pretty easy to send a PR and fixing the issue yourself. Commented Jan 3, 2014 at 23:01

1 Answer 1

2

It's like says @SimonBoudrias. You have to go to the following file path:

node_modules/grunt-bower-install/node_modules/wiredep/lib/inject-dependencies.js 

Add to fileTypesDefaults object, the object php

var fileTypesDefault = { html: { block: /(([\s\t]*)<!--\s*bower:*(\S*)\s*-->)(\n|\r|.)*?(<!--\s*endbower\s*-->)/gi, detect: { js: /<script.*src=['"](.+)['"]>/gi, css: /<link.*href=['"](.+)['"]/gi }, replace: { js: '<script src="{{filePath}}"></script>', css: '<link rel="stylesheet" href="{{filePath}}" />' } }, php: { block: /(([\s\t]*)<!--\s*bower:*(\S*)\s*-->)(\n|\r|.)*?(<!--\s*endbower\s*-->)/gi, detect: { js: /<script.*src=['"](.+)['"]>/gi, css: /<link.*href=['"](.+)['"]/gi }, replace: { js: '<script src="{{filePath}}"></script>', css: '<link rel="stylesheet" href="{{filePath}}" />' } }, yaml: { block: /(([\s\t]*)#\s*bower:*(\S*))(\n|\r|.)*?(#\s*endbower)/gi, detect: { js: /-\s(.+)/gi, css: /-\s(.+)/gi }, replace: { js: '- {{filePath}}', css: '- {{filePath}}' } } }; 

A regards

Sign up to request clarification or add additional context in comments.

1 Comment

This can also be passed in through your Gruntfile: github.com/stephenplusplus/grunt-bower-install#getting-started - you would just need to pass in the PHP portion of the above object ( fileTypes: { php: { /* ... */ } } I think I should probably just default unrecognized file extentions to use the HTML configuration.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.