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

          Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

          Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

          How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page