The question title is trying to be descriptive, but I feel I have to explain a bit further:
My goal is to use postcss (especially postcss-preset-env incl. autoprefixer) in my rails 5.2 app. I managed to setup webpack and get my prefixes, but with one major issue and its descendant that I hereby tackle:
(1) By design, webpack 'includes' (s)css files into application.js and adds prefixes to the css. However, as I like to leave my stylesheets within the assets folder of rails, I wonder how I could configure the whole thing so that e.g. rails compiles the assets, creates its css output, and serves that to webpack so that webpack can add prefixes, create JS workarounds and so on. Is this possible, or will I have to refactor all my styles into app/javascript/packs (instead of app/assets/stylesheets respectivly)?
(2) Trying to solve part (1) of this post, I read through this codemancers post. This post focuses on deployment with heroku (what is exactly what I want to do, eventually), and also tackles the "order of compilation thing". So I applied his suggestions hoping that it may solve my problem partly or at least give me some more insight into the webpack-rails internals, as this is a topic of highest complexity. It does not: The stylesheet assets do not get processed by postcss (I am not very suprised about that), and now webpack compilation happens twice (once before, and once after rails assets:compile)
As I really do not know what code may be of relevance, I do not add any for the sake of a clear view. Please tell me what files I shall post and I will happily do so.
Finally, as this would be a workaround I could live with: In case it is not possible to do what I want (or excessively complicated): Is there a clean way to reference the stylesheet assets within webpack's /app/javascript/packs/*.scss? As of sprockets fingerprinting, I cannot simply provide the path to the files I want to parse.
I hope I was able to make myself clear about the problem. Feel free to edit the answer for a better readability/understanding.
Best.