How to correctly use use Noty in ruby or rails

238 Views Asked by At

I'm new at Ruby on Rails and I was attempting to implement notifications using Noty but fails.

Installation procedure:

Stopped localhost server

$ yarn add noty
# app/javascript/packs/application.js
...
window.Noty = require("noty")

Below I'm unable to import noty

#app/assets/stylesheets/application.scss
...
@import "noty/lib/noty.js"; # not working
@import "noty/lib/noty";    # not working either

I can confirm the library is stated in the package.json and yarn.lock

I have also seen this possible solution, and in my assets.rb, node_modules is already referenced...

Rails.application.config.assets.paths << Rails.root.join('node_modules')

... and the files noty.css and noty.js already exist in node_modeles/noty/lib

1

There are 1 best solutions below

1
On

I solved this simply by downloading the files at noty Github and place them in the correct directory.