Skip to content

Instantly share code, notes, and snippets.

@milannankov
Last active February 24, 2019 13:19
Show Gist options
  • Save milannankov/805c34dec1febb811f1f2901640ff3e6 to your computer and use it in GitHub Desktop.
Save milannankov/805c34dec1febb811f1f2901640ff3e6 to your computer and use it in GitHub Desktop.
Developing SAPUI5 Applications with Visual Studio Code - Snippets
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
connect: {
options: {
port: 8080,
hostname: '*'
},
src: {},
dist: {}
},
openui5_connect: {
options: {
resources: [
'sdk/sapui5-sdk-1.52.8/resources',
],
testresources: [
'sdk/sapui5-sdk-1.52.8/test-resources',
]
},
src: {
options: {
appresources: 'webapp'
}
},
dist: {
options: {
appresources: 'dist'
}
}
},
openui5_preload: {
component: {
options: {
resources: {
cwd: 'webapp',
prefix: 'simple-app',
src: [
'**/*.js',
'**/*.fragment.html',
'**/*.fragment.json',
'**/*.fragment.xml',
'**/*.view.html',
'**/*.view.json',
'**/*.view.xml',
'**/*.properties',
'manifest.json',
'!test/**'
]
},
dest: 'dist'
},
components: true
}
},
clean: {
dist: 'dist',
coverage: 'coverage'
},
copy: {
dist: {
files: [ {
expand: true,
cwd: 'webapp',
src: [
'**',
'!test/**'
],
dest: 'dist'
} ]
}
},
eslint: {
webapp: ['webapp']
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-openui5');
// Server task
grunt.registerTask('serve', function(target) {
grunt.task.run('openui5_connect:' + (target || 'src') + ':keepalive');
});
// Build task
grunt.registerTask('build', ['clean:dist', 'openui5_preload', 'copy']);
// Default task
grunt.registerTask('default', ['serve']);
};
{
"name": "simple-app",
"version": "1.0.0",
"private": true,
"description": "",
"dependencies": {},
"devDependencies": {
"grunt": "^1.0.2",
"grunt-contrib-clean": "^1.1.0",
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-copy": "^1.0.0",
"grunt-openui5": "^0.13.0"
},
"scripts": {
"start": "grunt serve",
"build": "grunt build"
},
"author": "",
"license": "ISC"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment