Permalink
Browse files

fix(tasks): unwanted url replaced, fix #27

  • Loading branch information...
sparanoid committed Aug 15, 2018
1 parent 5fe5541 commit 17578386e7218b0761a9c135fcbb1467f73946ee
@@ -191,7 +191,7 @@ module.exports = function(grunt) {
} else {
var filePath = (style.substr(0, 1) === "/") ? path.resolve(options.cssDir, style.substr(1)) : path.join(path.dirname(filePair.src.toString()), style);
styles_dom_link_stylesheets[i].outerHTML = options.cssTags.start + grunt.file.read(filePath) + options.cssTags.end;
styles_dom_link_stylesheets[i].outerHTML = options.cssTags.start + grunt.file.read(filePath).replace(/[.]{2}\//g, options.assetsUrlPrefix) + options.cssTags.end;
var deleteFlag = (' (will keep)').gray;
if (deleteOriginal) {
@@ -230,7 +230,7 @@ module.exports = function(grunt) {
var filePath = (script.substr(0, 1) === "/") ? path.resolve(options.jsDir, script.substr(1)) : path.join(path.dirname(filePair.src.toString()), script);
//create and replace script with new scipt tag
scripts_dom[i].outerHTML = options.jsTags.start + uglifyJS(grunt.file.read(filePath)) + options.jsTags.end;
scripts_dom[i].outerHTML = options.jsTags.start + uglifyJS(grunt.file.read(filePath).replace(/[.]{2}\//g, options.assetsUrlPrefix)) + options.jsTags.end;
var deleteFlag = (' (will keep)').gray;
if (deleteOriginal) {
@@ -358,8 +358,6 @@ module.exports = function(grunt) {
}
var html = dom.serialize();
// replace relative path
html = html.replace(/[.]{2}\//g, options.assetsUrlPrefix);
grunt.file.write(path.resolve(filePair.dest), html);
grunt.log.writeln(('Created: ').green + path.resolve(filePair.dest) + '\n');
});
@@ -76,7 +76,14 @@
<body>
<h1>grunt-assets-inline</h1>
<p>Hello world! This is a test.</p>
<p onclick="alert(&quot;test&quot;)">Hello world! This is a test.</p>
<p>'../php_includes/googleTracking.php'</p>
<!--?php
//google tracking code
include '../php_includes/googleTracking.php';
?-->
<h2>This is a background image</h2>
<div class="backgroud-test-image"></div>
@@ -76,7 +76,14 @@
<body>
<h1>grunt-assets-inline</h1>
<p>Hello world! This is a test.</p>
<p onclick="alert(&quot;test&quot;)">Hello world! This is a test.</p>
<p>'../php_includes/googleTracking.php'</p>
<!--?php
//google tracking code
include '../php_includes/googleTracking.php';
?-->
<h2>This is a background image</h2>
<div class="backgroud-test-image"></div>
@@ -56,7 +56,14 @@
<body>
<h1>grunt-assets-inline</h1>
<p>Hello world! This is a test.</p>
<p onclick="alert(&quot;test&quot;)">Hello world! This is a test.</p>
<p>'../php_includes/googleTracking.php'</p>
<!--?php
//google tracking code
include '../php_includes/googleTracking.php';
?-->
<h2>This is a background image</h2>
<div class="backgroud-test-image"></div>
@@ -76,7 +76,14 @@
<body>
<h1>grunt-assets-inline</h1>
<p>Hello world! This is a test.</p>
<p onclick="alert(&quot;test&quot;)">Hello world! This is a test.</p>
<p>'../php_includes/googleTracking.php'</p>
<!--?php
//google tracking code
include '../php_includes/googleTracking.php';
?-->
<h2>This is a background image</h2>
<div class="backgroud-test-image"></div>
@@ -76,7 +76,14 @@
<body>
<h1>grunt-assets-inline</h1>
<p>Hello world! This is a test.</p>
<p onclick="alert(&quot;test&quot;)">Hello world! This is a test.</p>
<p>'../php_includes/googleTracking.php'</p>
<!--?php
//google tracking code
include '../php_includes/googleTracking.php';
?-->
<h2>This is a background image</h2>
<div class="backgroud-test-image"></div>
@@ -76,7 +76,14 @@
<body>
<h1>grunt-assets-inline</h1>
<p>Hello world! This is a test.</p>
<p onclick="alert(&quot;test&quot;)">Hello world! This is a test.</p>
<p>'../php_includes/googleTracking.php'</p>
<!--?php
//google tracking code
include '../php_includes/googleTracking.php';
?-->
<h2>This is a background image</h2>
<div class="backgroud-test-image"></div>
@@ -76,7 +76,14 @@
<body>
<h1>grunt-assets-inline</h1>
<p>Hello world! This is a test.</p>
<p onclick="alert(&quot;test&quot;)">Hello world! This is a test.</p>
<p>'../php_includes/googleTracking.php'</p>
<!--?php
//google tracking code
include '../php_includes/googleTracking.php';
?-->
<h2>This is a background image</h2>
<div class="backgroud-test-image"></div>
@@ -54,7 +54,14 @@
<body>
<h1>grunt-assets-inline</h1>
<p>Hello world! This is a test.</p>
<p onclick='alert("test")'>Hello world! This is a test.</p>
<p>'../php_includes/googleTracking.php'</p>
<?php
//google tracking code
include '../php_includes/googleTracking.php';
?>
<h2>This is a background image</h2>
<div class="backgroud-test-image"></div>

0 comments on commit 1757838

Please sign in to comment.