Multi-device hybrid apps: How to do combine, minify and obfuscate in release and distribution build process?

笑着哭i 提交于 2019-12-11 01:08:27

问题


Is there a good way to combine Javascript/Css files and do minification and obfuscation for the release and distribution builds using the multi-device hybrid apps project type for Visual Studio? I currently use Grunt for executing these tasks, but I'm interested in a complete Visual Studio driven process.


回答1:


You can use Grunt/gulp with the TaskRunner Explorer extension for Visual Studio.

To make sure your application will exclude the node_modules directory when you'll build it, you'll have to edit the util.js file in c:\Users_user_name_\AppData\Roaming\npm\node_modules\vs-mda\lib\ like this :

util.getDefaultFileNameEndingExclusions = function () {
    return [settings.projectSourceDir + '/bin',
            settings.projectSourceDir + '/bld',
            settings.projectSourceDir + '/node_modules',//add this line
            settings.projectSourceDir + '/merges',
            settings.projectSourceDir + '/plugins',
            settings.projectSourceDir + '/res',
            settings.projectSourceDir + '/test',
            settings.projectSourceDir + '/tests',
            '.jsproj', '.jsproj.user'];
}

This extension provides a grunt/gulp task control panel in visual studio :

Install your npm modules will be the only thing you will have to do out of Visual Studio

Hope that helps



来源:https://stackoverflow.com/questions/25274968/multi-device-hybrid-apps-how-to-do-combine-minify-and-obfuscate-in-release-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!