Comparing version 1.4.4 to 1.5.0
@@ -67,3 +67,7 @@ /* | ||
forEach(function (filePath) { | ||
newFileContents += spacing + fileType.replace[blockType].replace('{{filePath}}', filePath); | ||
if (typeof fileType.replace[blockType] === 'function') { | ||
newFileContents += spacing + fileType.replace[blockType](filePath); | ||
} else if (typeof fileType.replace[blockType] === 'string') { | ||
newFileContents += spacing + fileType.replace[blockType].replace('{{filePath}}', filePath); | ||
} | ||
}); | ||
@@ -70,0 +74,0 @@ |
{ | ||
"name": "wiredep", | ||
"main": "./wiredep.js", | ||
"version": "1.4.4", | ||
"version": "1.5.0", | ||
"description": "Wire Bower dependencies to your source code.", | ||
@@ -6,0 +6,0 @@ "repository": "taptapship/wiredep", |
@@ -6,5 +6,61 @@ # wiredep | ||
## Getting Started | ||
Install the module with: `npm install --save wiredep` | ||
Install the module with [npm](https://npmjs.org): | ||
```bash | ||
$ npm install --save wiredep | ||
``` | ||
Install your [bower](http://bower.io) dependencies (if you haven't already): | ||
```bash | ||
$ bower install --save jquery | ||
``` | ||
Insert placeholders in your code where your dependencies will be injected: | ||
```html | ||
<html> | ||
<head> | ||
<!-- bower:css --> | ||
<!-- endbower --> | ||
</head> | ||
<body> | ||
<!-- bower:js --> | ||
<!-- endbower --> | ||
</body> | ||
</html> | ||
``` | ||
Let `wiredep` work its magic: | ||
```bash | ||
$ node | ||
> require('wiredep')({ src: 'index.html' }); | ||
index.html modified. | ||
{ packages: | ||
{ jquery: | ||
{ main: [Object], | ||
type: [Object], | ||
name: 'jquery', | ||
dependencies: {} } }, | ||
js: [ 'bower_components/jquery/dist/jquery.js' ] } | ||
``` | ||
```html | ||
<html> | ||
<head> | ||
<!-- bower:css --> | ||
<!-- endbower --> | ||
</head> | ||
<body> | ||
<!-- bower:js --> | ||
<script src="bower_components/jquery/dist/jquery.js"></script> | ||
<!-- endbower --> | ||
</body> | ||
</html> | ||
``` | ||
## Build Chain Integration | ||
@@ -93,3 +149,6 @@ | ||
replace: { | ||
typeOfBowerFile: '<format for this {{filePath}} to be injected>' | ||
typeOfBowerFile: '<format for this {{filePath}} to be injected>', | ||
anotherTypeOfBowerFile: function (filePath) { | ||
return '<script class="random-' + Math.random() + '" src="' + filePath + '"></script>'; | ||
} | ||
} | ||
@@ -123,2 +182,14 @@ }, | ||
less: { | ||
block: /(([ \t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi, | ||
detect: { | ||
css: /@import\s['"](.+)['"]/gi, | ||
less: /@import\s['"](.+)['"]/gi | ||
}, | ||
replace: { | ||
css: '@import "{{filePath}}";', | ||
less: '@import "{{filePath}}";' | ||
} | ||
}, | ||
sass: { | ||
@@ -125,0 +196,0 @@ block: /(([ \t]*)\/\/\s*bower:*(\S*))(\n|\r|.)*?(\/\/\s*endbower)/gi, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28724
647
262