Unable to remove comments in CSS and/or JS during compiling
See original GitHub issue- Laravel Mix Version: 0.11.3 (
npm list --depth=0
) - Node Version (
node -v
): 7.9.0 - NPM Version (
npm -v
): 4.5.0 - OS:
Description:
Unable to remove comments in CSS and/or JS during compiling. The only way is to manually edit webpack.config.js
to add the parameters:
{ comments: false }
However, webpack.config.js
is inside the node_modules
directory, so the changes will not be pushed to git.
Steps To Reproduce:
Just run any npm run <script>
and comments are not removed.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Unable to remove comments in CSS and/or JS during compiling
Unable to remove comments in CSS and/or JS during compiling. The only way is to manually edit webpack.config.js to add the parameters:.
Read more >Remove LESS // comments on compile - css - Stack Overflow
So, to answer your question, you can't really strip out /**/ comments without using compress . Which does all other sorts of things...
Read more >How can I remove License comment from the bundle ... - HUGO
I'm trying to handle assets via Hugo pipes, but I found that there is a license comment in the final bundle. How can...
Read more >strip-comments - npm
Strip line and/or block comments from a string. Blazing fast, and works with JavaScript, Sass, CSS, Less.js, and a number of other languages ......
Read more >Trouble removing css comments with RegExp - JavaScript
I want to remove comments from css files using nodejs. I have this working fairly well: String.prototype.clean = function(){ return ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you want to remove all comments add this to your mix options (laravel-mix: 4)
P.S. @ruchern this comments not removed because starts with
*!
, see docs@ruchern To anyone that needs a solution to this. You can provide custom options to the webpack modules in
webpack.mix.js
, the original options are displayed in/node_modules/laravel-mix/src/Options.js
In laravel 5.4 i provided additional config option like below and all comments were stripped from my minified code, js and css alike.
You do need the
postcss-discard-comments
module for this.I think in the current version of laravel-mix it is done like this (not tested):