Skip to content

Conversation

@lury
Copy link

@lury lury commented Feb 4, 2014

separate different web pages, and add pagename, dimensions and time to filenames

command: phantomjs abovethefold.js http://example.com

result:

  • directory /output/example.com/ created (if not exists)

files saved to:

  • /output/example.com/example.com.1280x1024-2014-02-04T01:05:20.735Z-abovethefold.css
  • /output/example.com/example.com.1280x1024-2014-02-04T01:05:20.735Z-abovethefold.js

additional files for the same site are saved to the same directory.

added debug output to show files location:

*******************
Files saved to:
output/example.com/example.com.1280x1024-2014-02-04T01:05:20.735Z-abovethefold.{css,js}

separate different webpages, and add pagename, dimmensions and time to
filenames
    added debug output to show files location:

    *******************
    Files saved to:
    output/example.com/example.com.1280x1024-2014-02-04T01:05:20.735Z-abovethefold.{css,js}
abovethefold.js Outdated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could keep the path structure of the address and use fs.makeTree to mimic it in the folder structure. This would help keep the output directory nice and structured.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't you think that's a bit too much?
i'd rather keep this in a file name, because it'd make life harder to follow directory structure, and if you'd send someone the file, path would be lost.

Anyway, i've noticed that fs.makeDirectory is actually creating parent directories - try this out without "output" dir created in advance, and you'll end up with /output/example.com/ anyway.

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.

2 participants