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

Option to disable sass compilation #90

Open
dvdmlln opened this issue Jan 27, 2023 · 9 comments
Open

Option to disable sass compilation #90

dvdmlln opened this issue Jan 27, 2023 · 9 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@dvdmlln
Copy link

dvdmlln commented Jan 27, 2023

Hi,

I've build a module containing custom components along with global sass variables with default values. A project that uses this module can overwrite the default sass values and the module components use the new values.
However with module-builder ^0.2.1 sass is compiled to css and the former sass variables are now fixed values.
So for now I use fixed version 0.2.0 or did I miss a option to disable sass compilation?

Best regards,
David

@ennioVisco
Copy link

Any news about this? Looks like the upstream issues have been solved!

@ennioVisco
Copy link

ennioVisco commented Nov 9, 2023

Should be available since unjs/mkdist#152 has been merged in [email protected], although an issue on it has been opened last week (unjs/mkdist#182). Let's see how that evolves, and if everything checks we'll tag the devs here :)

@ennioVisco
Copy link

@guibulator let's keep the discussion here, I think you can close the issue on mkdist.

@danielroe would you kindly 🙏 bump the mkdist version and allow us to exclude sass from the builder like in https://github.com/wd-4000/mkdist/blob/22515607be5b47b9f065fa41a3fc8ca297b125af/src/loaders/index.ts (that has been accepted in [email protected] via unjs/mkdist#152)?

@danielroe
Copy link
Member

@ennioVisco We now have the latest mkdist version - do you need anything else, or do you think we can close this?

@ennioVisco
Copy link

@ennioVisco We now have the latest mkdist version - do you need anything else, or do you think we can close this?

Unfortunately, I think there is still a missing step: we need to be able to specify the loaders to use (or, to tell nuxt-module-builder to not pick the sass loader. Check this comment that should clarify the issue: unjs/mkdist#182 (comment)

@pi0
Copy link
Member

pi0 commented Jan 21, 2024

Sorry for late response.

This is how you can customize loaders:

// build.config.ts (in root of your module project)
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
  hooks: {
    'mkdist:entry:options' (_ctx, _entry, opts) {
      opts.loaders = ['js', 'vue'] // Default: ['js', 'vue', 'sass', 'postcss']
    }
  }
})

I guess we can make it easier (unjs/unbuild#361 and unjs/mkdist#194) and also documented for nuxt module builder.

@ennioVisco
Copy link

Sorry for late response.

This is how you can customize loaders:

// build.config.ts (in root of your module project)
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
  hooks: {
    'mkdist:entry:options' (_ctx, _entry, opts) {
      opts.loaders = ['js', 'vue'] // Default: ['js', 'vue', 'sass', 'postcss']
    }
  }
})

I guess we can make it easier (unjs/unbuild#361 and unjs/mkdist#194) and also documented for nuxt module builder.

Sweet, thanks a lot!!
Unfortunately, this still requires to have a full understanding of how unbuild is used in module-builder, which is not really straightforward, but perhaps @danielroe can help on providing that option directly from module-builder's api?

@pi0
Copy link
Member

pi0 commented Jan 21, 2024

module-builder is essentially a preset for unbuild. That's what I meant we need to better document how they related and work together :)

@ennioVisco
Copy link

ennioVisco commented Feb 18, 2024

Sorry for late response.

This is how you can customize loaders:

// build.config.ts (in root of your module project)
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
  hooks: {
    'mkdist:entry:options' (_ctx, _entry, opts) {
      opts.loaders = ['js', 'vue'] // Default: ['js', 'vue', 'sass', 'postcss']
    }
  }
})

I guess we can make it easier (unjs/unbuild#361 and unjs/mkdist#194) and also documented for nuxt module builder.

If someone stumbles upon this issue, I didn't get from pi0's reply that this actually can be added ON TOP of module-builder's build.config.ts, as it is actually written in the first comment of the code block. (And, it does solve the issue!)

Then, how /whenunbuild is able to work while chaining these build.config.ts files, is really magic for me and it would be very appreciated if this neat feature was documented a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants