Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

273
Views
Laravel mix, faster sass compilation with many ouput files

Context:

Hi, I am working on a website with a lot of reusable blocks each of which have a separate scss & js file.

In order to optimize performances, I've configured mix to output css in separated files so I can load them only if the corresponding block is present on the current page.

This is fine, except mix take more than 40 seconds to recompile now (instead of 6 seconds for a single output file) and this is slowing my work quite a bit...

Question:

How can I make mix compile faster in this situation, is it possible to recompile only the modified files ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Are you using version() object? I think you can cache the version when this is not changing.

This is a very basic example and hope it helps.


/*
* JS
* */
mix.setResourceRoot('/public/assets/admin/')
    .js('resources/js/app.js', 'public/assets/admin/')
    .version();
/*
* Styles
* */
mix.styles([
    'public/assets/admin/plugins/bootstrap/css/bootstrap.min.css',
    'public/assets/admin/css/style.min.css',
], 'public/assets/admin/app.css');
mix.sass('resources/sass/app.scss', 'public/assets/admin/app.css').options({
        postCss: [
            require('autoprefixer'),
        ],
    }).version();
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!