Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
359 views
in Technique[技术] by (71.8m points)

javascript - How to obfuscate vue js code used in django template as inline script?

I am developing an app using django as backend, and django templates for front end (Pages reload when navigating between urls).

For some advanced features, I had to use ajax communication between the template and the backend to avoid reloading for each action. So I ended up using vue js to react to server responses and also to build a pretty sophisticated UI.

Usually I use django compressor & uglifyjs to minify and mangle the variable names of my scripts build with jquery or vanilla js on each user request (middleware) using {% compress %}. This time with vue, when I mangle the data and function names, their references from the html in the v-if and v-bind: ...etc remains the same as before causing the UI to break because the v- instructions in the html doesn't use the new variable names after the mangling.

I want to know if there is a way to parse the html and rename the refrences with django compressor. In case compressor doesn't provide such feature, is there some npm package or other tool/script that I can manually feed a file.html containing both HTML and my vue js code and it does the renaming and returns a new file that i can use in production ?

Thanks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...