Arbu Posted October 26, 2021 Share Posted October 26, 2021 I've got a few bits of php in my javascript. I understand it's better to minify my code. But if I use a javascript minifier for the whole lot I get "// Error : Unexpected token: operator (<)" where the php is. So what to do? Should I minify the php and javascript separately? Could take quite a while to go through it all. Thanks. Link to comment Share on other sites More sharing options...
Ingolme Posted October 26, 2021 Share Posted October 26, 2021 If there is PHP embedded in your Javascript then I don't think it's worth minifying. Ideally, you would completely separate Javascript and PHP and rewrite the code so that Javascript obtains the data through other means, such as HTML data attributes (generated by PHP) or AJAX. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now