taptapship / wiredep Goto Github PK
View Code? Open in Web Editor NEWWire Bower dependencies to your source code.
License: MIT License
Wire Bower dependencies to your source code.
License: MIT License
GREAT module.
Is there a way I can use Regular Expressions in the exclude option?
thanks!
HI
I am trying to inject main.css
in index.html
between <head>
tag but i get below error...
here is gulpfile.js
var gulp = require('gulp');
var wiredep = require('wiredep').stream;
gulp.task('wiredep', function() {
gulp.src('app2/*.html')
.pipe(wiredep({
directory: 'app2/css'
}))
.pipe(gulp.dest('app2'));
});
then in terminal
gulp wiredep
and get result
[gulp] Using gulpfile /var/www/ProjecT/learn/grunt-example/gulp-app/gulpfile.js
[gulp] Starting 'wiredep'...
[gulp] Finished 'wiredep' after 8.68 ms
stream.js:94
throw er; // Unhandled stream error in pipe.
^
TypeError: Cannot read property 'main' of undefined
at findMainFiles (/var/www/ProjecT/learn/grunt-example/gulp-app/node_modules/wiredep/lib/detect-dependencies.js:64:37)
at /var/www/ProjecT/learn/grunt-example/gulp-app/node_modules/wiredep/lib/detect-dependencies.js:110:17
at forOwn (/var/www/ProjecT/learn/grunt-example/gulp-app/node_modules/wiredep/node_modules/lodash/dist/lodash.js:1301:15)
at Function.forEach (/var/www/ProjecT/learn/grunt-example/gulp-app/node_modules/wiredep/node_modules/lodash/dist/lodash.js:2595:9)
at detect (/var/www/ProjecT/learn/grunt-example/gulp-app/node_modules/wiredep/lib/detect-dependencies.js:311:5)
at wiredep (/var/www/ProjecT/learn/grunt-example/gulp-app/node_modules/wiredep/wiredep.js:162:39)
at Transform._transform (/var/www/ProjecT/learn/grunt-example/gulp-app/node_modules/wiredep/wiredep.js:201:34)
at Transform._read (/var/www/ProjecT/learn/grunt-example/gulp-app/node_modules/wiredep/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
at Transform._write (/var/www/ProjecT/learn/grunt-example/gulp-app/node_modules/wiredep/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
at doWrite (/var/www/ProjecT/learn/grunt-example/gulp-app/node_modules/wiredep/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:238:10)
So i've come across an issue when using Assemble where wiredep isn't working properly - unless i'm missing some config options?
Basically, if you have your handlebars layout template in app/templates/layout/default.hbs
, wiredep will try and match the bower_components
to ../../../bower_components
.
However, since Assemble handlebars templates need to be compiled, this path is incorrect. When running a watch server in development mode, the compiled templates are located at .tmp/index.html
making the correct bower_components
path ../bower_components
.
Is there a way i can fix this issue? Or add some sort of config options to my Gruntfile to enable this sort of functionality.
Stephen — sorry to bug you about this again.
Can we use grunt.file.expand (http://gruntjs.com/api/grunt.file#grunt.file.expand) in line 136 of:
https://github.com/stephenplusplus/wiredep/blob/master/lib/inject-dependencies.js
The idea is allow my grunt config to accept <%= yeoman.dist %>/{,/}.html as an option, rather than having to list every new .html file that I create every time.
Let me know how I can contribute. I'm not very familiar with npm package development and what are the best practices — specially when it comes to unit testing.
I thought it might be easier if I push this onto your plate, or if you know someone who's more familiar with it.
@sindresorhus — do you happen to know anything that want to take this off from Stephen's plate. Last I heard from Stephen was that he's busy with other priorities.
Reference: yeoman/generator-webapp#236
Please voice your concerns.
Thanks!
you must include license text for MIT license
So I swear this was working before, but all of a sudden on a new project, I take my exact same build system and apply it to the new project and I'm faced with a jquery was not injected in your file
error.
I've been able to create a reduced test case to reliably recreate this issue on my system (Mac OSX 10.9.1). Create a new directory and run the following in the terminal:
npm install wiredep
bower init
bower install --save jquery
echo "<html>
<body>
<!-- bower:js -->
<!-- endbower -->
</body>
</html>" >> index.html
echo "var wiredep = require('wiredep');
wiredep({
directory: 'bower_components',
bowerJson: require('./bower.json'),
src: ['index.html']
});" >> index.js
node index
and it ends with:
jquery was not injected in your file.
Please go take a look in "bower_components/jquery" for the file you need, then manually include it in your file.
some pieces of software use noscript tag to include some CSS files, it's impossible to use wiredep for those scripts, because CSS gets distorted, so it could be nice to change the regular expression so if the filename contains the string "noscript" the CSS reference will be put inside a noscript tag.
One popular JQuery that does that for example is the popular http://blueimp.github.io/jQuery-File-Upload/
Wish I had time to write test and pull request myself.
Thanks for the amazing work.
What do you think about adding an option to specify a separate destination directory, allowing source files to function as templates?
This would be especially useful in grunt-world, where you have to copy the template file before calling wiredep to get this behavior. I just ran into this use case today, so I wanted to get some opinions on whether this would be useful to add to wiredep.
primary usecase: sass-bootstrap
I included it to have access to the scss libraries however my bower:css block will still include the compiles bower css
I was just trying to setup a new project at work using the yeoman generator for angular and it wouldn't finish running.
I looked at the logs and found there was a problem in wiredep
npm ERR! Error: ENOENT, lstat '/<project_folder>/node_modules/grunt/package.json'
bower ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/es5-shims/es5-shim.git", exit code of #128
Additional error details:
remote: Repository not found.
fatal: repository 'https://github.com/es5-shims/es5-shim.git/' not found
/Users/edward.moore/npm/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:55
if (_.isString(componentConfigFile.main)) {
^
TypeError: Cannot read property 'main' of undefined
at findMainFiles (/Users/edward.moore/npm/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:55:37)
at /Users/edward.moore/npm/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:101:17
at forOwn (/Users/edward.moore/npm/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:1301:15)
at Function.forEach (/Users/edward.moore/npm/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:2595:9)
at detect (/Users/edward.moore/npm/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:290:5)
at module.exports (/Users/edward.moore/npm/lib/node_modules/generator-angular/node_modules/wiredep/bin/wiredep:34:40)
at Generator._injectDependencies (/Users/edward.moore/npm/lib/node_modules/generator-angular/app/index.js:286:5)
at /Users/edward.moore/npm/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:229:13
at /Users/edward.moore/npm/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:110:21
at /Users/edward.moore/npm/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:24:16
Issue also open in generator-angular yeoman/generator-angular#565
Any help on this issue would be great.
OS X: 10.9.1
node: v0.10.25
npm: 1.3.24
yo: 1.1.2
generator-angular: 0.7.1
Not sure if this is an issue with grunt-bower-install or wiredep, but files like jquery.plugin.js
don't get included. I found this out when trying to require jquery-bridget.
I'm not sure that new Regex for scss and sass is correct.
According to (sass-lang)[http://sass-lang.com/guide]
Notice we're using @import 'reset'; in the base.scss file. When you import a file you don't need to include the file extension .scss. Sass is smart and will figure it out for you.
See http://regex101.com/r/aO8gC7/1
I'm missing something?
Can we publish the changes from #75 as version 1.7.4?
Trying to get chjj/marked installed with grunt bower-install
. I forked it and renamed component.json to bower.json thinking this would fix the error "marked was not injected into your file".
Traced the problem into wiredep, and bower.
Bower writes a package metadata file into .bower.json
which doesn't seem to have the "main" attribute that is necessary for wiredep to find the file to inject. (https://github.com/bower/bower/blob/b64d8bfab32b1c7112ce024879b0b7f072c5f80b/lib/core/resolvers/Resolver.js)
After running bower install, here are the two files.
.bower.json
{
"name": "marked",
"homepage": "https://github.com/chjj/marked",
"version": "0.3.2",
"_release": "0.3.2",
"_resolution": {
"type": "version",
"tag": "v0.3.2",
"commit": "43db549e31af5ff6e4a3b12e41a23513b9f88c99"
},
"_source": "git://github.com/chjj/marked.git",
"_target": "~0.3.1",
"_originalSource": "marked"
}
bower.json
{
"name": "marked",
"version": "0.3.2",
"repo": "chjj/marked",
"description": "A markdown parser built for speed",
"keywords": ["markdown", "markup", "html"],
"scripts": ["lib/marked.js"],
"main": "lib/marked.js",
"license": "MIT"
}
Because wiredep looks at .bower.json first
https://github.com/stephenplusplus/wiredep/blob/master/lib/detect-dependencies.js#L28
['.bower.json',
'bower.json',
'component.json',
'package.json'].forEach(function (configFile) {
configFile = path.join(config.get('bower-directory'), component, configFile);
if (!_.isObject(componentConfigFile) && fs.existsSync(configFile)) {
componentConfigFile = JSON.parse(fs.readFileSync(configFile));
}
No main
is found, and the package doesn't get injected. Switching the position of those two would be easier than tracking down the problem within bower. Why does wiredep look at .bower.json
first?
I use 'bower-config'
in my own package.json
so it sits right under node_modules/bower-config
, but it seems wiredep
can't find this package:
Warning: Cannot find module '..../my-app/node_modules/grunt-wiredep/node_modules/wiredep/node_modules/bower-config' Use --force to continue.
Is this a problem with wiredep or modmod
?
Is it possible to add configuration somewhere so I can tell wiredep to generate "devDependencies" above "dependencies" in my src html ?
More details here: yeoman/generator-angular#624
Related issue on grunt-bower-install: stephenplusplus/grunt-wiredep#65
NOTE: Don't want to repeat the issue details, but for sake of keeping the relationship across where I am having this issue.
Thanks.
overrides
property didn't work as I expected when a package already had main
, but I wanted to add more (or reduce some). I expected that the main
property in overrides
would simply replace the original, but it seems the array was replaced element by element. I don't remember exactly, but the original main
went something like this:
"main": [
"src/a.js",
"src/b.js",
"src/c.js"
]
and main
in my overrides
was this:
"main": [
"src/d.js",
"src/e.js"
]
When I included these dependencies (via gulp wiredep
in generator-gulp-webapp), the result was:
<!-- bower:js -->
<script src="bower_components/my-component/src/d.js"></script>
<script src="bower_components/my-component/src/e.js"></script>
<script src="bower_components/my-component/src/c.js"></script>
<!-- endbower -->
Was this intentional?
(I hope this isn't another non-issue, I'll test it again tomorrow.)
I need to figure out something better for warning messages. Providing a more helpful message, with a link to create an issue on an offending repo might be good. Ideas welcome!
These should always come first:
As originally suggested from stephenplusplus/grunt-wiredep#8
This should be pretty easy... Mostly copying the default config block from yaml.
Given the following config
test: {
src: 'karma.conf.js',
devDependencies: true,
fileTypes: {
js: {
block: /(([\s\t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi,
detect: {
js: /'.*\.js'/gi
},
replace: {
js: '\'{{filePath}}\','
}
}
}
}
and the following src
'use strict';
module.exports = function(config) {
config.set({
frameworks: [ 'jasmine' ],
files: [
// bower:js
// endbower
// src and tests
'src/**/*.js'
],
reporters: [ 'progress' ],
browsers: [ 'PhantomJS' ],
singleRun: true
});
};
I get the following error:
Warning: Object 314 has no method 'replace'
The error occurs in inject-dependencies.js:60
with the line filesCaught.push(reference.replace(/['"\s]/g, ''));
. It happens that reference
is a number with the value 314
. Wrapping it inside String()
solves the error: filesCaught.push(String(reference).replace(/['"\s]/g, ''));
The output is as expected.
Any idea why this happens?
There is a strange behavior, when defining the following .bowerrc file:
{
"directory" : "public/bower_components"
}
Excluding files in bowerInstall (inside the Grunt-file) will not work anymore:
bowerInstall: {
app: {
src: ['<%= config.app %>/index.html'],
exclude: ['public/bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap.js']
},
...
}
I tried do change the exclude-path to:
1.) 'public/bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap.js',
2.) 'bower_components/bootstrap-sass-official/vendor/assets/javascripts/bootstrap.js',
3.) 'bootstrap-sass-official/vendor/assets/javascripts/bootstrap.js'
But it couldn't solve the problem. All bootstrap-files will be included into the index.html :-(
..Or is there something I forgot to configure?
How to replicate the problem:
I am using Win 8.1
I apologize for the crude issue-post. my English is not the best.
Thanks so much for your help, and for this awesome project.
https://github.com/yeoman/bower-requirejs#using-bower-hooks
You should do that on gunt-wiredep too.
For some reason angular-route doesn't get wired up:
bower.json
"dependencies": {
"underscore": "",
"angular": "",
"angular-route": ""
},
gulpfile
wiredep({
directory: lib,
bowerJson: require('./bower.json'),
src: dest + '/index.html'
});
results in > index.html
<!-- bower:js-->
<script src="lib/angular/angular.js"></script>
<script src="lib/underscore/underscore.js"></script>
<!-- endbower-->
I'm using jade templates, but still want to use grunt-bower-install to insert my dependencies. Everything works great, but I'd like the option to omit the <!-- bower:js -->
and <!-- endbower -->
sigils from the final output when doing the replacement.
Does this seem like a reasonable option? If so, I can put together a pull request with the functionality.
I have the following bower.json dependencies:
"dependencies": {
"modernizr": "2.6.2",
"angular": "1.2.x",
"jquery": "1.9.x",
"angular-cookies": "1.2.x",
"angular-touch": "1.2.x",
"angular-sanitize": "1.2.x",
"angular-resource": "1.2.x",
"angular-route": "1.2.x",
"angular-strap": "~2.0.3",
"angular-i18n": "~1.2.18",
"angular-translate": "~2.2.0",
"angular-translate-loader-static-files": "~2.2.0",
"angular-translate-storage-cookie": "~2.2.0",
"angular-dynamic-locale": "~0.1.17",
"bootstrap": "~3.2.0",
"angular-chosen-localytics": "~1.0.6"
}
and in my HTML page I'm utilizing wiredep like so:
<!-- bower:js -->
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-touch/angular-touch.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-strap/dist/angular-strap.min.js"></script>
<script src="bower_components/angular-strap/dist/angular-strap.tpl.min.js"></script>
<script src="bower_components/angular-translate/angular-translate.js"></script>
<script src="bower_components/angular-translate-loader-static-files/angular-translate-loader-static-files.js"></script>
<script src="bower_components/angular-translate-storage-cookie/angular-translate-storage-cookie.js"></script>
<script src="bower_components/angular-dynamic-locale/src/tmhDynamicLocale.js"></script>
<script src="bower_components/chosen/chosen.jquery.js"></script>
<script src="bower_components/angular-chosen-localytics/chosen.js"></script>
<!-- endbower -->
The issue is, every time wiredep runs in my gulp task it removes the chosen.jquery.js script and then tells me chosen was not injected in my file and I need to find the file I need in "app/bower_components/chosen". If I remove the '.jquery' potion of the filename it seems to work okay. Is the dependency detection off since jquery has already been fulfilled?
I have a jQuery plugin project and the only thing it uses bower for is testing. Thus I have jQuery as a prereq in my bower.json
devDependencies
object. Since wiredep only looks in dependencies
, I can't use it.
See PR #22
I am trying to use the bower overrides to add a new dependency for instance inject firebase before angularfire. I have the following in my bower.json but it does not work, firebase is still after angularfire.
{
...
"overrides": {
"angularfire": {
"dependencies": {
"firebase": "~1.0.2"
}
}
}
...
}
Following the advice from http://cameronspear.com/blog/streams-in-wiredep/, I'm changing my gulp calls to wiredep to wrap them in pipe calls. I updated to 1.6.2 and am otherwise running the latest versions of everything else (Windows 8.1 x64, Node 0.10.28, Gulp 3.6.2, Bower 1.3.3).
My gulp task looks like so:
gulp.task 'init2', ->
gulp.src './src/dev.html'
.pipe wiredep()
.pipe gulp.dest '.src/dev.html'
.on 'error', gutil.log
return
When I execute it, I get the error:
[gulp] 'init2' errored after 57 ms Object #<Object> has no method 'on'
Executing wiredep by itself works as expected (but I need wiredep to operate in a sequence of piped calls).
Adding gulp-debug doesn't improve the output by much (see https://gist.github.com/somecallmechief/da0b56be9d2015c8cb2a).
Is there a way around this fault?
I'm using yeoman angular generator, which comes with grunt-bower-install and bootstrap 3.
index.html:
<!-- build:css styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<!-- endbower -->
<!-- endbuild -->
Gruntfile.js
// Automatically inject Bower components into the app
'bower-install': {
app: {
html: '<%= yeoman.app %>/index.html',
ignorePath: '<%= yeoman.app %>/'
}
}
Now I want to use a theme from bootswatch instead of the default bootstrap 3 css. So I ran:
bower install bootswatch --save
This creates a bootswatch dir in bower_components like this:
However, I'm unsure how to configure the grunt bower-install task to load from one of the bootswatch themes. Running grunt serve
(which runs bower-install) results in error message:
bootswatch was not injected in your file.
Please go take a look in "app\bower_components\bootswatch" for the file you need, then manually include it in your file.
Then I read doc on grunt-bower-install which led to wiredep as the place to configure options.
But I can't figure out how to configure wiredep to select a css file from a different directory.
For example, I would like to say, replace the contents <!-- bower:css -->
with bower_components\bootswatch\flatly
Does anyone know how to do this?
Hello,
Most libraries have two versions XXX.js and XXX.min.js.
Ideally standard version should be taked in dev build task and minified version in production build task.
For now, min and standard versions of the differents library are mixed, because of the main directive in bower file rarely present and it's impossible to change this behavior.
So it would be fine to add an option for this.
Moreover this would save time on minification task.
Thanks.
Hey @CWSpear,
Because of your effort into improving this tool, you are now a member of @taptapship/buddies and have write permissions to this repository. There is no pressure to do anything, but I just wanted to say thanks for your time 👍
It would be nice (and relatively easy to implement) allowing users to just configure dependencies that don't have a 'main' defined.
The warning would just say, configure main for xyz in .bowerrc.
Is there a way to integrate wiredep with browserify?
I have my bower components setup as aliases within the browserify grunt task at the moment:
browserify: {
options: {
alias: [
"bower_components/jquery/dist/jquery.js:jquery",
"bower_components/jquery-hammerjs/jquery.hammer-full.js:hammer",
"bower_components/iosslider/_src/jquery.iosslider.min.js:iosslider",
"bower_components/momentjs/moment.js:moment",
"bower_components/social-likes/social-likes.min.js:socialLikes"
],
[...]
}
}
Due you reckon there's scope to automate this using wiredep?
Hi I copied the code from yeoman/generator-webapp#2 (comment)
and I am trying to incorporate it into my gulp file.
I get the error "Cannot find module 'bower.json'" when the file does exist. I might be doing something wrong with gulp..
gulp.task('wiredep', function(){
wiredep({
directory: 'lib',
bowerJson: require('bower.json'),
src: 'output/index.html'
});
});
I want to use elasticsearch.angular.js instead of elasticsearch.js (per the elasticsearch package main setting). When I try to override in bower.json it doesn't work.
{
"name": "angular-app",
"version": "0.0.0",
"dependencies": {
"angular": "1.2.6",
"elasticsearch": "~2.1.2"
},
"overrides": {
"elasticsearch": {
"main": "elasticsearch.angular.js"
}
}
}
--> results in nothing being injected in index.html
However, if I put a space in front of the file, it will update my index.html file correctly, but with the space
{
"name": "angular-app",
"version": "0.0.0",
"dependencies": {
"angular": "1.2.6",
"elasticsearch": "~2.1.2"
},
"overrides": {
"elasticsearch": {
"main": " elasticsearch.angular.js"
}
}
}
--> results in
<script src="bower_components/elasticsearch/ elasticsearch.angular.js"></script>
When no directory was explicitly specified and the bower_components folder can't be found in it's usual place, I think the .bowerrc file should be checked for a folder location. If it's not specified there, the error can proceed as per normal.
wiredep v1.8.2 on npm is breaking since it doesn't have glob
as a saved dependency.
Hey there,
i might be at the wrong location here and maybe I am doing something terribly wrong. But following my confusion I got here.
Heres the deal: I got wiredep 1.8.1 as a grunt task through yeomans webapp generator.
first this is what i got after yeoman ran bower install:
<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<!-- endbower -->
<!-- endbuild -->
after running grunt wiredep
I got this:
<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_componenjquery/dist/jquery.js"></script>
<script src="bower_componenbootstrap-sass-official/vendor/assets/javascripts/bootstrap/affix.js"></script>
<!-- ...lots of bootstrap stuff with the same issue... -->
<script src="bower_componenbootstrap-sass-official/vendor/assets/javascripts/bootstrap/popover.js"></script>
<!-- endbower -->
<!-- endbuild -->
which doesn't work obviously ;)
thanks in advance!
We have the following bower.json.
{
"name": "Vidzor",
"version": "0.1.0",
"authors": [
"Vadasz Laszlo <[email protected]>"
],
"description": "Interactive video",
"keywords": [
"interactive",
"video"
],
"license": "Commercial",
"homepage": "vidzor.com",
"private": true,
"dependencies": {
"lodash": "~2.4",
"jquery": "~1",
"jqueryui": "~1.10",
"popcorn-js": "~1.5",
"jaxloader": "[email protected]:pulilab/jaxloader.git#~2.0",
"handlebars": "~1.3",
"angular": "~1.2",
"angular-cookies": "~1.2",
"angular-resource": "~1.2",
"angular-mocks": "~1.2",
"angular-route": "~1.2",
"ngstorage": "~0.3",
"angular-bootstrap": "~0.10",
"parsleyjs": "~1.2",
"select2": "~3.4.6",
"when": "~1.8",
"raven-js": "~1.1",
"tracekit": "*",
"ua-parser-js": "~0.6.2",
"classlist": "~2013.5.14",
"mustache": "~0.7",
"bootstrap": "~3.1.1"
},
"overrides": {
"lodash":{
"main": "dist/lodash.js"
},
"jqueryui": {
"main": [
"ui/jquery.ui.core.js",
"ui/jquery.ui.mouse.js",
"ui/jquery.ui.widget.js",
"ui/jquery.ui.slider.js",
"themes/base/jquery.ui.slider.css"
]
},
"select2": {
},
"parsleyjs": {
"main": "parsley.js"
},
"ua-parser-js": {
"main": "src/ua-parser.js"
}
}
}
This worked fine with wiredep 1.4.4, but the main overrides are not taken up by 1.4.4.
Were there any config changes we should be aware? (We run wiredep with gulp.)
The hook works perfectly after a bower install
, however it fails to insert the relevant new tag after running an individual component install, i.e. bower install --save angular
. Bower outputs that the postinstall hook is still being invoked in these situations.
I'm using wiredep() API to discover bower dependencies for a command-line tool. Sometimes, when a bower package has no bower.json
or main
fields, wiredep will spit some warnings into the console. e.g.
jquery-ui-tabs was not injected in your file.
Please go take a look in "bower_components/jquery-ui-tabs" for the file you need, then manually include it in your file.
My application isn't using wiredep's HTML injection feature, so the warnings are confusing. Ideally I would like a way of hooking into the warnings, so I can produce my own application-specific output.
The function should not alter the style of the file. Some tasks, most notably grunt-usemin, test for the return type used in the file. If they find "\r\n" is used, they assume this is true across the whole file. Because the function always use "\n", this can lead to issues.
Hi
I think some form of parsing error occurs here. I'm using bower with socket.io-client. When overriding in the grunt-wiredep (or my bower.json) like so:
overrides: {
'socket.io-client': {
main: 'socket.io.js'
}
}
I get the injection: <script src="bower_components/socket.io-socket.io.js"></script>
It should be <script src="bower_components/socket.io-client/socket.io.js"></script>
Changing the main field to become main: 'client/socket.io.js'
works.
Error: ENOENT, chmod '.../node_modules/wiredep/wiredep-cli.js'
The file is missing, this is because wiredep-cli.js
is missing from the files
section in the package.json
file.
"files": [
"lib/",
"LICENSE",
"wiredep.js",
"wiredep-cli.js"
],
Will this plugin have Jade support?
for some reason the path is being overwritten with a wrong one
it should be
<script src="vendor/angular-http-auth/src/http-auth-interceptor.js"></script>
it get overwritten to
<script src="vendor/angular-http-auth/http-auth-interceptor.js"></script>
angular-http-auth's bower
{ "author": "Witold Szczerba", "name": "angular-http-auth", "version": "1.2.1", "homepage": "https://github.com/witoldsz/angular-http-auth", "repository": { "type": "git", "url": "git://github.com/witoldsz/angular-http-auth.git" }, "main": "./src/http-auth-interceptor.js", "dependencies": { "angular": "^1.2" } }
my bower.json
{ "dependencies": { "jquery": "~2.1.0", "bootstrap": "~3.1.1", "summernote": "~0.5.0", "angular": "~1.2.14", "angular-bootstrap": "~0.10.0", "angular-ui-router": "~0.2.9", "angular-ui-utils": "~0.1.1", "angular-http-auth": "~1.2.1", "angular-xeditable": "~0.1.8", "angular-route": "~1.2.14", "angular-animate": "~1.2.14", "angular-resource": "~1.2.14", "angular-sanitize": "~1.2.14" }, "devDependencies": { "angular-mocks": "~1.2.14", "angular-scenario": "1.2.6" }, "overrides": { "angular-http-auth": { "main": "./src/http-auth-interceptor.js" }, "summernote": { "main": ["./dist/summernote.min.js", "./dist/summernote.css"] } } }
note: summernote overwrite works perfectly
versions
Mac OS
node -v v0.10.1
npm -v1.3.25
wiredep: 1.2.2
"grunt-bower-install": "~1.0.2"
"grunt": "~0.4.1",
I already tried : bower cache clean, reinstall dependencies
please let me know if you have the same problem with the package
thanks
Not so much an issue as an idea for an improvement.
In wordpress, a good idea is the use the hook into wp_head to include your css and script files. It would be really cool if this, and bower-install, would output a properly formatted wp_enqueue_script or wp_enqueue_style (and register function call) (http://codex.wordpress.org/Function_Reference/wp_enqueue_script) to be installed into the theme functions for wordpress.
When I have more time, I will make a fork and try to work on it.
Thanks for the great tool!
(for an angular app) I would tag this as a feature request. After searching, I could not find another module that does this.
I see that I can change the directory for bower components in the .bowerrc, but I would like to have another in addition. I have /app/bower_components and /app/components. In /app/components I have a bunch of custom modules -- and will be adding more -- that I am getting tired of adding manually to my index.html. I was thinking the .bowerrc could be like:
[{
// without conf property, defaults to "bower.json"
"directory": "app/bower_components"
},{
"conf": "components.json"
"directory": "app/components"
}]
Each component would be expected to have its own bower.json with a main.
Does this seem reasonable/doable?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.