Coder Social home page Coder Social logo

Recreate directory tree about htmlclean HOT 12 CLOSED

anseki avatar anseki commented on June 13, 2024
Recreate directory tree

from htmlclean.

Comments (12)

anseki avatar anseki commented on June 13, 2024

Hi mathpere.
Thank you for your post.
I agree to your proposal. It's useful.
But htmlclean must know where the root of directory tree is. New option might have to be added.
I think more about it.

from htmlclean.

mathpere avatar mathpere commented on June 13, 2024

Thanks for your feedback.
I don't understand why you would need new option.

For this given structure:

src
|--- index.html
|--- subfolder1
         |--- view1.html
         |--- view2.html

If I modify line 268 of htmlclean binary like this:

pair(paths[0] + (paths[0].substr(-1) !== '/' ? '/' : '') + '/**/*.html', output);

I create destination directory: mkdir www

And I execute this command: htmlclean src -o www

I get this structure:

www
|--- index.html
|--- view1.html
|--- view2.html

Could we use the exact same option by modifying the behavior when HTML files like view1.html, view2.html are not located at the root of src or am I wrong?

from htmlclean.

anseki avatar anseki commented on June 13, 2024

If you want only that behavior, htmlclean don't have to be modified. Just do htmlclean "src/**/*.html" -o www.

A subfolder1 directory is missing in www.
"recreate directory tree" you said. That is, subfolder1 must be made, right?

from htmlclean.

anseki avatar anseki commented on June 13, 2024

If the structure is:

src
|--- index.html
|--- subfolder1
|        |--- view1.html
|        |--- view2.html
|--- subfolder2
         |--- view1.html
         |--- view2.html

view1.html in www are mixed from subfolder1/view1.html and subfolder2/view1.html. view2.html too.

from htmlclean.

mathpere avatar mathpere commented on June 13, 2024

Oh I'm sorry, my comment was not very clear.

By executing htmlclean src -o www I get this structure

www
|--- index.html
|--- view1.html
|--- view2.html

But I would like

www
|--- index.html
|--- subfolder1
         |--- view1.html
         |--- view2.html

So I confirm: htmlclean should first automatically create subfolder1 folder (e.g. mkdirp)

from htmlclean.

anseki avatar anseki commented on June 13, 2024

Yes, therefore, I think new option have to be added.
htmlclean must know where the root of directory tree is. htmlclean must be given the root via new option, when it can't presume the root.
In your sample, a subfolder1 directory missing in www. Then mkdir subfolder1 is needed. It's very simple. because it is clear that src is root.
But, actually, the paths that is given might be not root, or the plurality of those are mixed, maybe.
For example:

  • src/content1/*.html (I want to make content1 directory in www.)
  • src/@(content1|content2)/*.html
  • src{1,2}
  • project1/src (Don't make src directory in www.)

from htmlclean.

anseki avatar anseki commented on June 13, 2024

I rewrote. Please check new version 2.6.0.

The --root option was added.

  • If you specify one root directory (even if it includes pattern) to input (like your sample), you have to do nothing. Because the specific directory is considered as the root.
  • Note that if a directory is specified to the input, it is considered as directory/**/*.html. Not directory/*.html.

And, I close this issue. If there is problem, please reopen it.

from htmlclean.

mathpere avatar mathpere commented on June 13, 2024

Not yet sure if this is an issue but when I execute this command: htmlclean src -o www

I get this following error Error: ENOENT, no such file or directory ''

from htmlclean.

anseki avatar anseki commented on June 13, 2024

Thank you for test.
Please check again in verbose mode.

htmlclean src -o www -v

And, permission of www is ok?

from htmlclean.

anseki avatar anseki commented on June 13, 2024

Sorry, I mistook...
I fixed it.
Please try v2.6.1.

from htmlclean.

mathpere avatar mathpere commented on June 13, 2024

I tried version 2.6.2, it works like a charm, thank you!

from htmlclean.

anseki avatar anseki commented on June 13, 2024

Thank you for report 😀

from htmlclean.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.