carlosarli
Hello everyone,
I’m trying to add the package datepicker-moment to my phoenix application but can’t seem to solve some configuration issues. I installed it via npm then went to brunch.config and in the npm section I whitelisted datepicker-moment. I would like to add the stylesheet too but when I add it to styles it throws an error as i already have another style there. So first question howdo you add multiple styles in the npm section of brunch config? Is that all I have to do to set up an npm package? I then went to app.js and wrote import datepicker from “datepicker-moment” but then in my views it says that .datepicker is not a function while jquery and everythin else works so I’m guessing I am not importing it right…
Thank you for your help
Carlo
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
peerreynders
If you have a look at the
package.jsonyou’ll find.https://docs.npmjs.com/files/package.json#main
Gruntfile.jsis a taskrunner configuration file. As far as I can tell that package is not suitable for bundling by Brunch or any other bundler (FYI: Phoenix is moving to Webpack 4).This problem happens frequently with older JavaScript libraries that are barely being maintained (another example).
carlosarli
Oh I see… pity. Thanks for the help though
Do you happen to know a good brunch compatible timepicker by any chance?
peerreynders
Nope. But somebody else may know of one that can be properly
required (orimported; which is the fundamental issue).For some background you may be interested in Modern JavaScript Explained For Dinosaurs (no insult intended, I didn’t pick the title).
carlosarli
Ahah thank you and don’t worry I am not that easy to insult
I actually think it is a funny title especially as I have a form of rejection to learning js
carlosarli
Sorry to bother you again but 2 quick questions:
Thanks
EDIT
I managed to import the right css file just still no glypicons for some reason
dokuzbir
I didnt test but i think these work for datepicker-moment
carlosarli
Thank you! I’ll give that a go
dokuzbir
for font-awesome and glyphicons you need copy cat
npm install --save-dev copycat-brunchThis is for bootstrap sass you can configure if you dont use bootstrap-sass
carlosarli
ok that is odd but thanks ahah
peerreynders
I ran into that - in my case Phoenix distribution didn’t include
glyphicons-halflings-regular- i.e. bootstrap is incomplete.There needs to be a
static/fontsfolder with:The
app.cssfile has the bootstrap CSS baked in which references these fonts.“eonasdan-bootstrap-datetimepicker”: [‘build/bootstrap-datetimepicker.min.css’],doesn’t look like a path undernode_modules(hence the name of the configuration:npm)You’d have to look at modifying
instead.
The
joinTosupports a variety of pattern matching styles.