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

Flatpickr Includes #86

Closed
amathieson opened this issue Nov 17, 2021 · 6 comments
Closed

Flatpickr Includes #86

amathieson opened this issue Nov 17, 2021 · 6 comments

Comments

@amathieson
Copy link

An issue I have faced for a little while was to do with compiling with Flatpickr, I don't know if I am alone with this issue, but the way I solved it was to edit components/picker/_ui-picker.scss to make the @use paths relative

@elf-mouse
Copy link
Member

Hi @winer222 , Dart Sass can load plain old .css files (about flatpickr).

If you're working on a project built independently with webpack, it might have something to do with the sass-loader's includePaths option

@amathieson
Copy link
Author

Hi @elf-mouse thanks for the reply, this project does use webpack / laravel mix. I am not super familiar with sass-loader's configurations, below is my webpack.mix.js file. if you could point me in the right direction that would be very appreciated.
Thanks again,
Adam Mathieson

// webpack.mix.js

let mix = require('laravel-mix');


mix
    .js('src/app.js', 'dist/app.js').js('src/login.js', 'dist/login.js').vue()
    .sass('src/app.scss', 'dist/app.css').sass('src/login.scss', 'dist/login.css').setResourceRoot('/').setPublicPath('')
    .extract(['leaflet','vue','vue-router','balm-ui']);
mix.version();
mix.browserSync('127.0.0.1:80');
// mix.browserSync({});

if (mix.inProduction()) {
    mix.then(() => {
        const convertToFileHash = require("laravel-mix-make-file-hash");
        convertToFileHash({
            publicPath: "",
            manifestFilePath: "mix-manifest.json"
        });
    });
}

@SparK-Cruz
Copy link

SparK-Cruz commented Jan 20, 2022

I'm on vue3 and the use of flatpickr also bit me
SassError: Can't find stylesheet to import.

@elf-mouse
Copy link
Member

elf-mouse commented Jan 21, 2022

Hi @winer222 @SparK-Cruz , I've verified that it's because the sass-loader in a manual project doesn't have a webpack-like resolve.modules by default configuration.

So, we need to configure it manually, like this:

  • webpack.mix.js

    const mix = require("laravel-mix");
    
    mix.webpackConfig({
        resolve: {
            alias: {
                vue: "vue/dist/vue.esm-bundler.js",
                "balm-ui-plus": "balm-ui/dist/balm-ui-plus.esm.js",
                "balm-ui-css": "balm-ui/dist/balm-ui.css",
            },
        },
    });
    
    mix.sass("resources/css/app.scss", "public/css", {
        sassOptions: {
            includePaths: ["node_modules"],
        },
    })
        .js("resources/js/app.js", "public/js")
        .vue();
  • resources/js/app.js

    import { createApp } from "vue";
    import App from "./App.vue";
    
    import BalmUI from "balm-ui";
    import BalmUIPlus from "balm-ui-plus";
    // import "balm-ui-css";
    
    const app = createApp(App);
    
    app.use(BalmUI);
    app.use(BalmUIPlus);
    
    app.mount("#app");
  • resources/css/app.scss

    @use "@material/theme/variables" with (
        $primary: red
    );
    
    @use "balm-ui/dist/balm-ui";

Have a great weekend! Thanks again :)

@amathieson
Copy link
Author

amathieson commented Jan 21, 2022

Thanks for the reply and the pointers in the right direction! Your patch worked perfectly! (I have also started supporting the project on Patreon to show my appreciation for your work ;) )

@elf-mouse
Copy link
Member

@winer222 , Thank you very much for supporting BalmUI. I will always sync with Google MDC to restore and extend Material Design for vue as much as possible.

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

3 participants