Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tagname customizable to avoid conflicts with other libs #54

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lucipacurar
Copy link

No description provided.

@coveralls
Copy link

coveralls commented Oct 21, 2016

Coverage Status

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

@VFK
Copy link
Owner

VFK commented Oct 22, 2016

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?

@lucipacurar
Copy link
Author

lucipacurar commented Oct 26, 2016

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.

@coveralls
Copy link

coveralls commented Oct 26, 2016

Coverage Status

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

@VFK
Copy link
Owner

VFK commented Oct 27, 2016

@lucassp I merged #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.

@lucipacurar
Copy link
Author

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

@VFK VFK mentioned this pull request Nov 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants