Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Rails: Implementing Toastr


Hello, I'm working with the fantastic Metronic 8 Rails starter app (v8.1.7), but I noticed Toastr isn't in settings.yml as a vendor.

I'm trying to implement it to use for Rails flash messages, but so far haven't been able to figure out how to get it implemented. Any advice? I used yarn/gulp for the build.

Thanks!


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)


Hi Ian Adams,

Glad you have solved it. We will add the instruction in the docs.

Thanks



Nevermind. I found the answer in the Custom Bundles section of the docs. Just had to remove the "toastr" section from the "optional" section of the gulp.config.js file, then put this in the "custom" section of the same file:


toastr: {
src: {
styles: ["{$config.path.common_src}/plugins/toastr/build/toastr.css"],
scripts: ["{$config.path.common_src}/plugins/toastr/build/toastr.min.js"],
},
dist: {
scripts: "{$config.dist}/plugins/custom/toastr/toastr.bundle.js",
styles: "{$config.dist}/plugins/custom/toastr/toastr.bundle.css",
}
},


The run gulp again.

Finally added the following to the settings.yml file:

"toastr": {
"js": [
"custom/toastr/toastr.bundle.js"
],
"css": [
"custom/toastr/toastr.bundle.css"
]
}


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(