Install and configure a pickadate package with Laravel Mix Hi,
I'm stucked with the import of npm package here: https://www.npmjs.com/package/pickadate In this package there is CSS and JS but I don't know how can I exactly import them in my app.
I've done this :
window.pickadate = require('pickadate');
And try in my app.js to :
pickadate.('.datepicker').pickadate();
The error is :
$(...).pickadate is not a function
I don't want to bower again ;)
Thanks for your help
first of all install the package
npm install pickadate --save
//or
yarn add pickdate
and than it should work!
This what I did the directory exists in node_modules/pickadate.
I think is the way I instantiate the module that I don't understand.
window.pickadate = require('pickadate'); works well but how can I do the instanciation of this module in js ?
Any ideas ?
$(function() {
$('.datepicker').pickadate();
});
I used a lot Bower but this library get older.
Same error $('.datepicker').pickadate(); outputs in console : function pickadate not found.
I don't put links in header for CSS and footer cause the package is in node_modules.
The mistake can be here. Is there a good tutorial in package installation through NPM in Laravel ?
My problem is unfortunately unsolved :(
Here is the code :
In app.js
$(document).ready(function() {
// Init Datepicker
$('.datepicker').pickadate();
});
In webpack I try to include the script like this
.js([
'node_modules/pickadate/lib/picker.js',
'node_modules/pickadate/lib/picker.date.js',
'node_modules/pickadate/lib/picker.time.js',
'resources/assets/js/app.js'
], 'public/js/app.js', './')
I think I'm going to retry Bower. I'm really stucked with webpack to include a jquery plugin.
If someone knows ...
Please sign in or create an account to participate in this conversation.