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

Sample code #8

Open
earlyriser opened this issue May 18, 2020 · 1 comment
Open

Sample code #8

earlyriser opened this issue May 18, 2020 · 1 comment

Comments

@earlyriser
Copy link

Thanks for creating this.

Do you have a sample of this plugin installed?

I have followed the instructions but I don't get it to work.

`
const axios = require('axios')
const localImages = require('eleventy-plugin-local-images');

module.exports = function (eleventyConfig) {

eleventyConfig.addCollection('pages', async collection => {
const response = await axios({
method: 'get',
url: 'http://localhost:1337/pages'
})
.then(response => {
return response.data
})
.catch(error => {
// Handle error
})
console.log(response);

return response ? response : []

})

eleventyConfig.addPlugin(localImages, {
  distPath: '_site',
  assetPath: '/assets',
  selector: 'img',
  verbose: true
});

}
`

_site folder has this structure:
-assets
-en
--page1
--page2
-fr
--page1
--page2

Thanks!

@earlyriser
Copy link
Author

I solved this issue applying the change on the PR: https://github.com/robb0wen/eleventy-plugin-local-images/pull/5/files

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

No branches or pull requests

1 participant