Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Custom SCSS in Laravel Start Kit


I'm having a problem with laravel mix about adding new scss or jssad

What is the best practice to add custom scss or js in laravel start kit?

ex.

I have a page

view - resources/view/page/homepage.blade.php
scss - <where>/page/homepage.scss
js - <where>/page/homepage.jssad


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi James,

Sure, here is a better answer:

The best practice to add custom SCSS or JS in Laravel Start Kit is to use the `addJavascriptFile()` function. This function takes a path to a JavaScript file as its argument. For example, to add the file `assets/js/custom/authentication/sign-in/general.js`, you would use the following code:


addJavascriptFile("assets/js/custom/authentication/sign-in/general.js");


You can also use the `addStylesheet()` function to add a custom SCSS file. This function takes a path to a SCSS file as its argument. For example, to add the file `assets/scss/custom/authentication/sign-in/general.scss`, you would use the following code:


addCssFile("assets/scss/custom/authentication/sign-in/general.scss");


You can find more examples of how to use these functions in the following files:


app/Http/Controllers/Auth/AuthenticatedSessionController.php
app/Core/Bootstrap/BootstrapDefault.php


I hope this is helpful!


Thanks


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(