gulp-html-replace icon indicating copy to clipboard operation
gulp-html-replace copied to clipboard

Make tagname customizable to avoid conflicts with other libs

Open lucipacurar opened this issue 8 years ago • 6 comments

lucipacurar avatar Oct 21 '16 07:10 lucipacurar

Coverage Status

Coverage remained the same at 98.077% when pulling f1581a50e0f090b9c8df34ba5523e1006c5f71df on lucassp:master into 38e66fd157e8d243e70e099b89382b3dc321a99a on VFK:master.

coveralls avatar Oct 21 '16 07:10 coveralls

Thank you for you PR @lucassp Does this work on Windows for you? AppVeyor tests passed just fine so i think there will be no problems but i'm still curious what was the problem here in the first place. Could you also add an explanation of the new option somewhere here?

VFK avatar Oct 22 '16 06:10 VFK

The tests still fail on Windows:

Buffer mode
1) should replace blocks
2) should replace blocks with custom tag
√ should work with inline html
√ should not fail if there are no build tags at all
Options
keepUnassigned
√ Should keep empty blocks
√ Should remove empty blocks
keepBlockTags
√ Should keep placeholder tags without arguments
√ Should keep placeholder tags with arguments
√ Should remove placeholder tags without arguments
√ Should remove placeholder tags with arguments
√ Should keep indentation
resolvePaths
√ Should resolve relative paths
Legacy versions
√ [version <1.2] should keep empty blocks (keepUnassigned = true)
√ [version <1.2] should remove empty blocks (keepUnassigned = false)

null files
√ should be passed through

Stream mode
3) should replace blocks
4) should replace blocks with custom tag
√ should work with inline html
√ should not fail if there are no build tags at all
Options
keepUnassigned
√ Should keep empty blocks
√ Should remove empty blocks
keepBlockTags
√ Should keep placeholder tags without arguments
√ Should keep placeholder tags with arguments
√ Should remove placeholder tags without arguments
√ Should remove placeholder tags with arguments
√ Should keep indentation
resolvePaths
√ Should resolve relative paths
Legacy versions
√ [version <1.2] should keep empty blocks (keepUnused = true)
√ [version <1.2] should remove empty blocks (keepUnused = false)

1) Buffer mode should replace blocks:

      Uncaught AssertionError: '<!DOCTYPE html>\r\n<html>\r\n<head lang="en">\r\n    <meta charset="UTF-8">\r\n    <title>Test file</title>\r\n\r\n    <link re === '<!DOCTYPE html>\r\n<html>\r\n<head lang="en">\r\n    <meta charset="UTF-8">\r\n    <title>Test file</title>\r\n\r\n    <link re
      + expected - actual

       <head lang="en">
           <meta charset="UTF-8">
           <title>Test file</title>

      -    <link rel="stylesheet" href="css/combined.css">
      -
      +    <link rel="stylesheet" href="css/combined.css">
       </head>
       <body>
      -    <script src="js/one.js"></script>
      -    <script src="js/two.js?ts=123"></script>
      -    <script src="js/three.js?v=v1.5.3-1-g91cd575"></script>
      +    <script src="js/one.js"></script>
      +    <script src="js/two.js?ts=123"></script>
      +    <script src="js/three.js?v=v1.5.3-1-g91cd575"></script>

      +<script src="js/with_tpl.js"></script>

      -<script src="js/with_tpl.js"></script>
      +<script src="js/with_tpl.js"></script>
      +<script src="js/with_tpl_2.js"></script>

      +<script data-main="js/with_tpl_2vars1.js" src="js/with_tpl_2vars2.js"></script>

      -<script src="js/with_tpl.js"></script>
      -<script src="js/with_tpl_2.js"></script>
      +<script data-main="js/with_tpl_2vars1.js" src="js/with_tpl_2vars2.js"></script>
      +<script data-main="js/with_tpl_2vars1_2.js" src="js/with_tpl_2vars2_2.js"></script>

      +<script src="js/index.min.js"></script>

      -<script data-main="js/with_tpl_2vars1.js" src="js/with_tpl_2vars2.js"></script>
      +<script src="js/index.min.js"></script>

      +<script data-src="index.data" src="js/with_tpl.js"></script>
      +<script data-src="index.data" src="js/with_tpl_2.js"></script>

      -<script data-main="js/with_tpl_2vars1.js" src="js/with_tpl_2vars2.js"></script>
      -<script data-main="js/with_tpl_2vars1_2.js" src="js/with_tpl_2vars2_2.js"></script>
      +<script data-src="index.html" data-main="js/with_tpl_2vars1.js" src="js/with_tpl_2vars2.js"></script>

      +<script data-src="index.data" data-main="js/with_tpl_2vars1.js" src="js/with_tpl_2vars2.js"></script>
      +<script data-src="index.data" data-main="js/with_tpl_2vars1_2.js" src="js/with_tpl_2vars2_2.js"></script>

      -<script src="js/index.min.js"></script>
      +Lorem ipsum dolor sit amet, consectetur adipiscing elit.

      +Stream simple replacement

      -<script src="js/index.min.js"></script>
      +Stream advanced replacement

      -
      -<script data-src="index.data" src="js/with_tpl.js"></script>
      -<script data-src="index.data" src="js/with_tpl_2.js"></script>
      -
      -
      -<script data-src="index.html" data-main="js/with_tpl_2vars1.js" src="js/with_tpl_2vars2.js"></script>
      -
      -
      -<script data-src="index.data" data-main="js/with_tpl_2vars1.js" src="js/with_tpl_2vars2.js"></script>
      -<script data-src="index.data" data-main="js/with_tpl_2vars1_2.js" src="js/with_tpl_2vars2_2.js"></script>
      -
      -
      -Lorem ipsum dolor sit amet, consectetur adipiscing elit.
      -
      -
      -Stream simple replacement
      -
      -
      -Stream advanced replacement
      -
      -
      -Stream $$ special replacement pattern
      -
      +Stream $$ special replacement pattern
       </body>
       </html>

      at Transform.<anonymous> (C:\Projects\gulp-html-replace\test\buffer.js:15:16)
      at readableAddChunk (C:\Projects\gulp-html-replace\node_modules\readable-stream\lib\_stream_readable.js:213:18)
      at Transform.Readable.push (C:\Projects\gulp-html-replace\node_modules\readable-stream\lib\_stream_readable.js:172:10)
      at Transform.push (C:\Projects\gulp-html-replace\node_modules\readable-stream\lib\_stream_transform.js:123:32)
      at afterTransform (C:\Projects\gulp-html-replace\node_modules\readable-stream\lib\_stream_transform.js:79:51)
      at TransformState.afterTransform (C:\Projects\gulp-html-replace\node_modules\readable-stream\lib\_stream_transform.js:58:12)
      at Parser.<anonymous> (C:\Projects\gulp-html-replace\lib\index.js:43:29)
      at endReadableNT (C:\Projects\gulp-html-replace\node_modules\readable-stream\lib\_stream_readable.js:922:12)
      at _combinedTickCallback (internal/process/next_tick.js:74:11)
      at process._tickCallback (internal/process/next_tick.js:98:9)

For me it looks like it's adding a new line everytime it replaces a block.

lucipacurar avatar Oct 26 '16 10:10 lucipacurar

Coverage Status

Coverage remained the same at 98.077% when pulling 94ce38244bf6f22e574f6aa5c63316c4e765e951 on lucassp:master into 38e66fd157e8d243e70e099b89382b3dc321a99a on VFK:master.

coveralls avatar Oct 26 '16 11:10 coveralls

@lucassp I merged https://github.com/VFK/gulp-html-replace/pull/55 can you please try it now on Windows? I didn't release a new version yet so it's not in NPM, you need to download this repo manually.

VFK avatar Oct 27 '16 04:10 VFK

@VFK I cloned the current repo today and ran the tests, and the tests still fail on Windows.

lucipacurar avatar Nov 14 '16 12:11 lucipacurar