0

I am a beginner to this framework. i have added new css files in my sass folder and compiled them successfully to use.

How can i add new js file in assets folder and compile them to use ?

1
  • You can just add them directly in the assets folder and target them using the <script src="gotoassets/custom.js"></script> Commented Jun 29, 2018 at 2:19

2 Answers 2

1

You can do somethink like this but before stop npm compiling:

mix.js('resources/assets/js/app.js', 'public/js')
    .js('resources/frontend/js/scripts.js', 'public/js')
    .sass('resources/assets/sass/app.scss', 'public/css')
    .sass('resources/frontend/scss/style.scss', 'public/css');

And then run just npm run dev or npm run watch.

Sign up to request clarification or add additional context in comments.

2 Comments

i do not have a default "Frontend" named folder... can i place this file in "assets/js" folder and then compile ? ... why is the need of external folder..
@LaviJ i did it for myself. You can just add another.js to same folder where app.js located.
1

i concluded some things as a beginner: 1. we put our js or css files in assets/css, assets/js folder and using webpack.min.js we compile this files and minimize. 2. after compilation, the compiled code generates in public/css, public/js folders accordingly. 3. My js file has some external links and things as i am using a theme for a blog, and it is getting issues in compilation. 4. the solution is to put your files directly in public/js or public/css folders .

If anyone has any further suggession... please share.

Thanks

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.