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?
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
add a comment |
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
add a comment |
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
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
css laravel npm import flatpickr
asked Mar 7 at 4:35
HartleySanHartleySan
3,27353158
3,27353158
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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
Interesting. I did not know that. Thank you so much. So is this a common pattern for Node modules? That is, within thenode_modules
package directory, is there usually adist
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 theimport
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 beingnode_modules
in the project root.
– keyboardSmasher
Mar 7 at 13:34
Very helpful. Thanks a lot.
– HartleySan
Mar 7 at 14:46
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
Interesting. I did not know that. Thank you so much. So is this a common pattern for Node modules? That is, within thenode_modules
package directory, is there usually adist
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 theimport
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 beingnode_modules
in the project root.
– keyboardSmasher
Mar 7 at 13:34
Very helpful. Thanks a lot.
– HartleySan
Mar 7 at 14:46
add a comment |
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
Interesting. I did not know that. Thank you so much. So is this a common pattern for Node modules? That is, within thenode_modules
package directory, is there usually adist
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 theimport
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 beingnode_modules
in the project root.
– keyboardSmasher
Mar 7 at 13:34
Very helpful. Thanks a lot.
– HartleySan
Mar 7 at 14:46
add a comment |
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
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
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 thenode_modules
package directory, is there usually adist
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 theimport
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 beingnode_modules
in the project root.
– keyboardSmasher
Mar 7 at 13:34
Very helpful. Thanks a lot.
– HartleySan
Mar 7 at 14:46
add a comment |
Interesting. I did not know that. Thank you so much. So is this a common pattern for Node modules? That is, within thenode_modules
package directory, is there usually adist
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 theimport
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 beingnode_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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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