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

Change output directory #47

Closed
tombeers opened this issue Dec 15, 2017 · 5 comments · Fixed by #48
Closed

Change output directory #47

tombeers opened this issue Dec 15, 2017 · 5 comments · Fixed by #48

Comments

@tombeers
Copy link

I can't seem to find a way to change where the resulting files are output. At the moment they are all put in webpack's output.path, but in my case this isn't ideal. Is there any way to change this?

Many thanks

@alex-ketch
Copy link
Collaborator

Think you're looking for the context parameter.

You can get a feel for its rough usage in this PR

@PeterKottas
Copy link

It took a bit of effort for me to figure it out so I though I'll provide my solution for the ones to come

{
  test: /\.(png|jpg|jpeg|gif)$/,
  use: {
    loader: 'responsive-loader',
    options: {
      adapter: require('responsive-loader/sharp'),
      placeholder: true,
      placeholderSize: 50,
      name: 'images/[name]-[hash]-[width].[ext]'
    }
  }
}

@tombeers
Copy link
Author

tombeers commented Dec 19, 2017

@PeterKottas ah brilliant, thank you for that

@alex-ketch thanks also for the input, but as far as I could tell, context changes the output directory for everything.

@tombeers
Copy link
Author

Also, while I'm new to webpack, and so don't know if it's implicitly obvious that there's a name property, it would be nice if it was listed in the readme.

@jstcki
Copy link
Contributor

jstcki commented Dec 19, 2017

@tombeers @PeterKottas I've documented the missing options in #48. I also updated the context implementation to be the same as file-loader. That said, file-loader has another option outputPath which does something similar but not the same thing? @alex-ketch any idea what the difference exactly is?

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 a pull request may close this issue.

4 participants