File tree 2 files changed +32
-0
lines changed
packages/browser-sync/templates
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ *
3
+ * Install:
4
+ * npm install browser-sync
5
+ *
6
+ * Run:
7
+ * node <yourfile.js>
8
+ *
9
+ * This example shows how you can place the snippet anywhere.
10
+ */
11
+
12
+ "use strict" ;
13
+
14
+ var path = require ( "path" ) ;
15
+ var browserSync = require ( "../packages/browser-sync" ) . create ( ) ;
16
+ var cwd = path . join ( __dirname , ".." ) ;
17
+ var fixtures_dir = path . join ( cwd , "packages/browser-sync/test/fixtures" ) ;
18
+
19
+ browserSync . init ( {
20
+ files : [ path . join ( fixtures_dir , "css/*.css" ) ] ,
21
+ server : fixtures_dir ,
22
+ snippetOptions : {
23
+ rule : {
24
+ match : / < \/ h e a d > / i,
25
+ fn : function ( snippet , match ) {
26
+ return snippet + match ;
27
+ } ,
28
+ } ,
29
+ } ,
30
+ } ) ;
Original file line number Diff line number Diff line change 8
8
script . src = '%script%' . replace ( "HOST" , location . hostname ) ;
9
9
if ( document . body ) {
10
10
document . body . appendChild ( script ) ;
11
+ } else if ( document . head ) {
12
+ document . head . appendChild ( script ) ;
11
13
}
12
14
} catch ( e ) {
13
15
console . error ( "Browsersync: could not append script tag" , e ) ;
You can’t perform that action at this time.
0 commit comments