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

Import all files with .CSV in folder? #144

Closed
jcyin1 opened this issue May 26, 2014 · 7 comments
Closed

Import all files with .CSV in folder? #144

jcyin1 opened this issue May 26, 2014 · 7 comments

Comments

@jcyin1
Copy link

jcyin1 commented May 26, 2014

Hello

In the following default CSV import code:

require 'rubygems'
require "jekyll-import"
JekyllImport::Importers::CSV.run({
"file" => "myfile.csv"
})

There is the option of specifying a single CSV file. Is it possible to have the script import all files with .CSV in current folder? I have quite a few CSV files and they change names quite often.

Thanks

@yihangho
Copy link

I guess you can do this:

require 'jekyll-import'

Dir['*.csv'].each do |name|
  JekyllImport::Importers::CSV.run "file" => name
end

@yihangho
Copy link

Leave out the initial forward slash:

Dir['csv/*.csv']

@jcyin1
Copy link
Author

jcyin1 commented May 26, 2014

Great, thanks a tone for your help! You seem really knowledgable about Jekyll and Ruby. May I ask if you have any suggestions for speeding up Jekyll's post generation?

I'm importing about 1,000 - 2,000 posts into Jekyll and each time I make some modification to posts, I have to regenerate the whole site. It takes about 30 minutes right now. I'm planning to increase the posts later on and at this rate, it will take a few hours to many hours in the future. Any ideas on methods I can speed up the post generation?

Thanks

@yihangho
Copy link

You're most welcomed.

That's a tricky issue. Some folks suggested incremental regeneration (#380). If you are adding new posts, and are trying to preview these new posts, you can use the --limit_posts flag to limit the number of posts to generate (See documentation). Other than that, I have no idea what can speed up the build.

@jcyin1
Copy link
Author

jcyin1 commented May 26, 2014

I won't really be adding individual posts, it's more like people write a lot of content and I upload them in one go after a few days. Will --limit-posts will help in this case?

Also does Jekyll use as much system resource as available? e.g. will increasing my VPS's memory and CPU have a noticeable improvement.

@yihangho
Copy link

Yes, --limit_posts helps when previewing your site. Say you've added 5 posts, you can run jekyll serve --limit_posts 10. This will generate and serve the 10 latest posts. When you are ready to publish, run jekyll build to build everything.

I am not too sure whether Jekyll will use all available system resource - my site has less than 100 posts, building it takes less than a minute. My guess is that there will be improvements, but not a lot as the bottleneck here is I/O.

@jcyin1
Copy link
Author

jcyin1 commented May 26, 2014

I see, so --limit_posts is more useful for previewing the site, but to really build and serve the site, I still need to run 'jekyll serve' or 'jekyll build' right, which takes quite a long time.

Okay no problem, thanks again for the great help you've been providing. If this was Stackoverflow, I'd really upvote your comments and answers :)

@jcyin1 jcyin1 closed this as completed May 26, 2014
@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants