This repository was archived by the owner on Mar 28, 2018. It is now read-only.
File tree 5 files changed +90
-0
lines changed
5 files changed +90
-0
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
Original file line number Diff line number Diff line change
1
+ # CSS Url Regex
2
+
3
+ [ ![ Build Status] ( https://travis-ci.org/johnotander/css-url-regex.svg?branch=master )] ( https://travis-ci.org/johnotander/css-url-regex )
4
+
5
+ A regular expression for matching CSS urls (` url(foo.css) ` ).
6
+
7
+ In the near future this will be likely moved to < https://github.com/regexps > .
8
+
9
+ ## Installation
10
+
11
+ ```
12
+ npm i --save css-url-regex
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ``` javascript
18
+ var cssUrl = require (' css-url-regex' );
19
+
20
+ cssUrl ().test (' url(bar.css)' ) // => true
21
+ cssUrl ().test (' kljhsdf' ) // => false
22
+ ```
23
+
24
+ ## License
25
+
26
+ MIT
27
+
28
+ ## Contributing
29
+
30
+ 1 . Fork it
31
+ 2 . Create your feature branch (` git checkout -b my-new-feature ` )
32
+ 3 . Commit your changes (` git commit -am 'Add some feature' ` )
33
+ 4 . Push to the branch (` git push origin my-new-feature ` )
34
+ 5 . Create new Pull Request
35
+
36
+ Crafted with <3 by [ John Otander] ( http://johnotander.com ) .
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ module . exports = function ( ) {
4
+ return / u r l \( .* ?\) / ig;
5
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " css-url-regex" ,
3
+ "version" : " 0.0.1" ,
4
+ "description" : " Regular expression for matching CSS urls." ,
5
+ "main" : " index.js" ,
6
+ "directories" : {
7
+ "test" : " test"
8
+ },
9
+ "scripts" : {
10
+ "test" : " mocha test"
11
+ },
12
+ "repository" : {
13
+ "type" : " git" ,
14
+ "url" : " https://github.com/johnotander/css-url-regex.git"
15
+ },
16
+ "keywords" : [
17
+ " css" ,
18
+ " css-url" ,
19
+ " regex" ,
20
+ " regexp"
21
+ ],
22
+ "author" : " John Otander <johnotander@gmail.com> (http://johnotander.com/)" ,
23
+ "license" : " MIT" ,
24
+ "bugs" : {
25
+ "url" : " https://github.com/johnotander/css-url-regex/issues"
26
+ },
27
+ "homepage" : " https://github.com/johnotander/css-url-regex" ,
28
+ "devDependencies" : {
29
+ "mocha" : " ^2.0.1"
30
+ }
31
+ }
Original file line number Diff line number Diff line change
1
+ var assert = require ( 'assert' ) ;
2
+ var cssUrl = require ( '..' ) ;
3
+
4
+ describe ( 'css-url-regex' , function ( ) {
5
+
6
+ it ( 'should find a css url with no quotes' , function ( ) {
7
+ assert . equal ( cssUrl ( ) . test ( 'url(foo.css)' ) , true ) ;
8
+ } ) ;
9
+
10
+ it ( 'should find a css url with quotes' , function ( ) {
11
+ assert . equal ( cssUrl ( ) . test ( "url('foo.css')" ) , true ) ;
12
+ } ) ;
13
+
14
+ it ( 'should not find a css url if it is not there' , function ( ) {
15
+ assert . equal ( cssUrl ( ) . test ( "('foo.css')" ) , false ) ;
16
+ } ) ;
17
+ } ) ;
You can’t perform that action at this time.
0 commit comments