How do I load the CSS for flatpickr when I use npm to install it in Laravel?2019 Community Moderator ElectionHow do I give text or an image a transparent background using CSS?When to use margin vs padding in CSSHow can I transition height: 0; to height: auto; using CSS?Where does npm install packages?How can I update NodeJS and NPM to the next versions?How do CSS triangles work?How do I vertically center text with CSS?Find the version of an installed npm packageHow to install an npm package from GitHub directly?What is the --save option for npm install?

Can I negotiate a patent idea for a raise, under French law?

Giving a career talk in my old university, how prominently should I tell students my salary?

How do we create new idioms and use them in a novel?

What materials can be used to make a humanoid skin warm?

Was it really inappropriate to write a pull request for the company I interviewed with?

Doubts in understanding some concepts of potential energy

Does "Until when" sound natural for native speakers?

Are all players supposed to be able to see each others' character sheets?

What do you call someone who likes to pick fights?

Windows Server Data Center Edition - Unlimited Virtual Machines

Making a kiddush for a girl that has hard time finding shidduch

Recommendation letter by significant other if you worked with them professionally?

Expressing logarithmic equations without logs

Doesn't allowing a user mode program to access kernel space memory and execute the IN and OUT instructions defeat the purpose of having CPU modes?

How to resolve: Reviewer #1 says remove section X vs. Reviewer #2 says expand section X

Proving a statement about real numbers

What will happen if my luggage gets delayed?

How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?

How do spaceships determine each other's mass in space?

Trig Subsitution When There's No Square Root

From an axiomatic set theoric approach why can we take uncountable unions?

Would an aboleth's Phantasmal Force lair action be affected by Counterspell, Dispel Magic, and/or Slow?

Which classes are needed to have access to every spell in the PHB?

PTIJ: Why does only a Shor Tam ask at the Seder, and not a Shor Mu'ad?



How do I load the CSS for flatpickr when I use npm to install it in Laravel?



2019 Community Moderator ElectionHow do I give text or an image a transparent background using CSS?When to use margin vs padding in CSSHow can I transition height: 0; to height: auto; using CSS?Where does npm install packages?How can I update NodeJS and NPM to the next versions?How do CSS triangles work?How do I vertically center text with CSS?Find the version of an installed npm packageHow to install an npm package from GitHub directly?What is the --save option for npm install?










4















I've got a Laravel project, and am trying to use flatpickr in it as per the following page:
https://flatpickr.js.org/getting-started/



I was able to install flatpickr via npm i flatpickr --save and properly import it into the JS code and use it via import flatpickr from "flatpickr";, but my question is: How do I get the CSS into the project as well?



I ended up using the following HTML link tag referenced in the flatpickr docs link above:



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">


But I'm wondering if there is a better way to get the CSS for flatpickr into my project.



That is, when you use npm to install a package and import it into JS, is there something similar for the CSS, or are we required to include the CSS using a traditional link tag and that's our only option?



I couldn't find anything in the docs or via Google on how to do this, so I'm really left wondering. Thanks.










share|improve this question


























    4















    I've got a Laravel project, and am trying to use flatpickr in it as per the following page:
    https://flatpickr.js.org/getting-started/



    I was able to install flatpickr via npm i flatpickr --save and properly import it into the JS code and use it via import flatpickr from "flatpickr";, but my question is: How do I get the CSS into the project as well?



    I ended up using the following HTML link tag referenced in the flatpickr docs link above:



    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">


    But I'm wondering if there is a better way to get the CSS for flatpickr into my project.



    That is, when you use npm to install a package and import it into JS, is there something similar for the CSS, or are we required to include the CSS using a traditional link tag and that's our only option?



    I couldn't find anything in the docs or via Google on how to do this, so I'm really left wondering. Thanks.










    share|improve this question
























      4












      4








      4








      I've got a Laravel project, and am trying to use flatpickr in it as per the following page:
      https://flatpickr.js.org/getting-started/



      I was able to install flatpickr via npm i flatpickr --save and properly import it into the JS code and use it via import flatpickr from "flatpickr";, but my question is: How do I get the CSS into the project as well?



      I ended up using the following HTML link tag referenced in the flatpickr docs link above:



      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">


      But I'm wondering if there is a better way to get the CSS for flatpickr into my project.



      That is, when you use npm to install a package and import it into JS, is there something similar for the CSS, or are we required to include the CSS using a traditional link tag and that's our only option?



      I couldn't find anything in the docs or via Google on how to do this, so I'm really left wondering. Thanks.










      share|improve this question














      I've got a Laravel project, and am trying to use flatpickr in it as per the following page:
      https://flatpickr.js.org/getting-started/



      I was able to install flatpickr via npm i flatpickr --save and properly import it into the JS code and use it via import flatpickr from "flatpickr";, but my question is: How do I get the CSS into the project as well?



      I ended up using the following HTML link tag referenced in the flatpickr docs link above:



      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">


      But I'm wondering if there is a better way to get the CSS for flatpickr into my project.



      That is, when you use npm to install a package and import it into JS, is there something similar for the CSS, or are we required to include the CSS using a traditional link tag and that's our only option?



      I couldn't find anything in the docs or via Google on how to do this, so I'm really left wondering. Thanks.







      css laravel npm import flatpickr






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 7 at 4:35









      HartleySanHartleySan

      3,27353158




      3,27353158






















          1 Answer
          1






          active

          oldest

          votes


















          1














          webpack.mix.js



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

          /*
          |--------------------------------------------------------------------------
          | Mix Asset Management
          |--------------------------------------------------------------------------
          |
          | Mix provides a clean, fluent API for defining some Webpack build steps
          | for your Laravel application. By default, we are compiling the Sass
          | file for the application as well as bundling up all the JS files.
          |
          */

          mix.js(['resources/js/app.js', 'node_modules/flatpickr/dist/flatpickr.js'], 'public/js')
          .sass('resources/sass/app.scss', 'public/css')
          .stylus('node_modules/flatpickr/src/style/flatpickr.styl', 'public/css');


          run npm run dev



          results in js/app.js and css/flatpickr.css






          ...or you could just add

          @import '~flatpickr/dist/flatpickr.css';



          to



          resources/sass/app.scss



          and run



          npm run dev



          Then you get all of your css (Bootstrap/flatpickr) in one file public/css/app.css






          share|improve this answer

























          • Interesting. I did not know that. Thank you so much. So is this a common pattern for Node modules? That is, within the node_modules package directory, is there usually a dist directory with all the CSS, etc.? Also, what's the difference between the CSS and Stylus files? Is Stylus like Sass/Less? Also, what does the tilde (~) in the import statement mean? Lastly, I'm using Vue-Multiselect (vue-multiselect.js.org). Would the pattern for getting the CSS for that be similar? Thanks again.

            – HartleySan
            Mar 7 at 12:00







          • 1





            ~ is sort of like a shortcut, but will look in some common locations. One being node_modules in the project root.

            – keyboardSmasher
            Mar 7 at 13:34











          • Very helpful. Thanks a lot.

            – HartleySan
            Mar 7 at 14:46










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55036170%2fhow-do-i-load-the-css-for-flatpickr-when-i-use-npm-to-install-it-in-laravel%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          webpack.mix.js



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

          /*
          |--------------------------------------------------------------------------
          | Mix Asset Management
          |--------------------------------------------------------------------------
          |
          | Mix provides a clean, fluent API for defining some Webpack build steps
          | for your Laravel application. By default, we are compiling the Sass
          | file for the application as well as bundling up all the JS files.
          |
          */

          mix.js(['resources/js/app.js', 'node_modules/flatpickr/dist/flatpickr.js'], 'public/js')
          .sass('resources/sass/app.scss', 'public/css')
          .stylus('node_modules/flatpickr/src/style/flatpickr.styl', 'public/css');


          run npm run dev



          results in js/app.js and css/flatpickr.css






          ...or you could just add

          @import '~flatpickr/dist/flatpickr.css';



          to



          resources/sass/app.scss



          and run



          npm run dev



          Then you get all of your css (Bootstrap/flatpickr) in one file public/css/app.css






          share|improve this answer

























          • Interesting. I did not know that. Thank you so much. So is this a common pattern for Node modules? That is, within the node_modules package directory, is there usually a dist directory with all the CSS, etc.? Also, what's the difference between the CSS and Stylus files? Is Stylus like Sass/Less? Also, what does the tilde (~) in the import statement mean? Lastly, I'm using Vue-Multiselect (vue-multiselect.js.org). Would the pattern for getting the CSS for that be similar? Thanks again.

            – HartleySan
            Mar 7 at 12:00







          • 1





            ~ is sort of like a shortcut, but will look in some common locations. One being node_modules in the project root.

            – keyboardSmasher
            Mar 7 at 13:34











          • Very helpful. Thanks a lot.

            – HartleySan
            Mar 7 at 14:46















          1














          webpack.mix.js



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

          /*
          |--------------------------------------------------------------------------
          | Mix Asset Management
          |--------------------------------------------------------------------------
          |
          | Mix provides a clean, fluent API for defining some Webpack build steps
          | for your Laravel application. By default, we are compiling the Sass
          | file for the application as well as bundling up all the JS files.
          |
          */

          mix.js(['resources/js/app.js', 'node_modules/flatpickr/dist/flatpickr.js'], 'public/js')
          .sass('resources/sass/app.scss', 'public/css')
          .stylus('node_modules/flatpickr/src/style/flatpickr.styl', 'public/css');


          run npm run dev



          results in js/app.js and css/flatpickr.css






          ...or you could just add

          @import '~flatpickr/dist/flatpickr.css';



          to



          resources/sass/app.scss



          and run



          npm run dev



          Then you get all of your css (Bootstrap/flatpickr) in one file public/css/app.css






          share|improve this answer

























          • Interesting. I did not know that. Thank you so much. So is this a common pattern for Node modules? That is, within the node_modules package directory, is there usually a dist directory with all the CSS, etc.? Also, what's the difference between the CSS and Stylus files? Is Stylus like Sass/Less? Also, what does the tilde (~) in the import statement mean? Lastly, I'm using Vue-Multiselect (vue-multiselect.js.org). Would the pattern for getting the CSS for that be similar? Thanks again.

            – HartleySan
            Mar 7 at 12:00







          • 1





            ~ is sort of like a shortcut, but will look in some common locations. One being node_modules in the project root.

            – keyboardSmasher
            Mar 7 at 13:34











          • Very helpful. Thanks a lot.

            – HartleySan
            Mar 7 at 14:46













          1












          1








          1







          webpack.mix.js



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

          /*
          |--------------------------------------------------------------------------
          | Mix Asset Management
          |--------------------------------------------------------------------------
          |
          | Mix provides a clean, fluent API for defining some Webpack build steps
          | for your Laravel application. By default, we are compiling the Sass
          | file for the application as well as bundling up all the JS files.
          |
          */

          mix.js(['resources/js/app.js', 'node_modules/flatpickr/dist/flatpickr.js'], 'public/js')
          .sass('resources/sass/app.scss', 'public/css')
          .stylus('node_modules/flatpickr/src/style/flatpickr.styl', 'public/css');


          run npm run dev



          results in js/app.js and css/flatpickr.css






          ...or you could just add

          @import '~flatpickr/dist/flatpickr.css';



          to



          resources/sass/app.scss



          and run



          npm run dev



          Then you get all of your css (Bootstrap/flatpickr) in one file public/css/app.css






          share|improve this answer















          webpack.mix.js



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

          /*
          |--------------------------------------------------------------------------
          | Mix Asset Management
          |--------------------------------------------------------------------------
          |
          | Mix provides a clean, fluent API for defining some Webpack build steps
          | for your Laravel application. By default, we are compiling the Sass
          | file for the application as well as bundling up all the JS files.
          |
          */

          mix.js(['resources/js/app.js', 'node_modules/flatpickr/dist/flatpickr.js'], 'public/js')
          .sass('resources/sass/app.scss', 'public/css')
          .stylus('node_modules/flatpickr/src/style/flatpickr.styl', 'public/css');


          run npm run dev



          results in js/app.js and css/flatpickr.css






          ...or you could just add

          @import '~flatpickr/dist/flatpickr.css';



          to



          resources/sass/app.scss



          and run



          npm run dev



          Then you get all of your css (Bootstrap/flatpickr) in one file public/css/app.css







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 7 at 6:19

























          answered Mar 7 at 5:43









          keyboardSmasherkeyboardSmasher

          1,9761316




          1,9761316












          • Interesting. I did not know that. Thank you so much. So is this a common pattern for Node modules? That is, within the node_modules package directory, is there usually a dist directory with all the CSS, etc.? Also, what's the difference between the CSS and Stylus files? Is Stylus like Sass/Less? Also, what does the tilde (~) in the import statement mean? Lastly, I'm using Vue-Multiselect (vue-multiselect.js.org). Would the pattern for getting the CSS for that be similar? Thanks again.

            – HartleySan
            Mar 7 at 12:00







          • 1





            ~ is sort of like a shortcut, but will look in some common locations. One being node_modules in the project root.

            – keyboardSmasher
            Mar 7 at 13:34











          • Very helpful. Thanks a lot.

            – HartleySan
            Mar 7 at 14:46

















          • Interesting. I did not know that. Thank you so much. So is this a common pattern for Node modules? That is, within the node_modules package directory, is there usually a dist directory with all the CSS, etc.? Also, what's the difference between the CSS and Stylus files? Is Stylus like Sass/Less? Also, what does the tilde (~) in the import statement mean? Lastly, I'm using Vue-Multiselect (vue-multiselect.js.org). Would the pattern for getting the CSS for that be similar? Thanks again.

            – HartleySan
            Mar 7 at 12:00







          • 1





            ~ is sort of like a shortcut, but will look in some common locations. One being node_modules in the project root.

            – keyboardSmasher
            Mar 7 at 13:34











          • Very helpful. Thanks a lot.

            – HartleySan
            Mar 7 at 14:46
















          Interesting. I did not know that. Thank you so much. So is this a common pattern for Node modules? That is, within the node_modules package directory, is there usually a dist directory with all the CSS, etc.? Also, what's the difference between the CSS and Stylus files? Is Stylus like Sass/Less? Also, what does the tilde (~) in the import statement mean? Lastly, I'm using Vue-Multiselect (vue-multiselect.js.org). Would the pattern for getting the CSS for that be similar? Thanks again.

          – HartleySan
          Mar 7 at 12:00






          Interesting. I did not know that. Thank you so much. So is this a common pattern for Node modules? That is, within the node_modules package directory, is there usually a dist directory with all the CSS, etc.? Also, what's the difference between the CSS and Stylus files? Is Stylus like Sass/Less? Also, what does the tilde (~) in the import statement mean? Lastly, I'm using Vue-Multiselect (vue-multiselect.js.org). Would the pattern for getting the CSS for that be similar? Thanks again.

          – HartleySan
          Mar 7 at 12:00





          1




          1





          ~ is sort of like a shortcut, but will look in some common locations. One being node_modules in the project root.

          – keyboardSmasher
          Mar 7 at 13:34





          ~ is sort of like a shortcut, but will look in some common locations. One being node_modules in the project root.

          – keyboardSmasher
          Mar 7 at 13:34













          Very helpful. Thanks a lot.

          – HartleySan
          Mar 7 at 14:46





          Very helpful. Thanks a lot.

          – HartleySan
          Mar 7 at 14:46



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55036170%2fhow-do-i-load-the-css-for-flatpickr-when-i-use-npm-to-install-it-in-laravel%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived