Skip to content
This repository has been archived by the owner on Jan 3, 2020. It is now read-only.

Commit

Permalink
Merge fix/error-fail-sanitize
Browse files Browse the repository at this point in the history
Fix/error fail sanitize
  • Loading branch information
diego-antonelli authored Jan 16, 2019
2 parents 6ae9923 + fadf47d commit 984ab67
Show file tree
Hide file tree
Showing 7 changed files with 2,314 additions and 3,781 deletions.
36 changes: 28 additions & 8 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
"use strict";
const webpack = require("webpack");
const webpackConfig = require("./webpack.config");
const merge = require("webpack-merge");
const ExtractTextPlugin = require("extract-text-webpack-plugin");

const webpackConfig = require("./webpack.config");
const packageJson = require("./package.json");

const widgetName = packageJson.widgetName;
const name = widgetName.toLowerCase();

const webpackConfigRelease = webpackConfig.map(config => merge(config, {
devtool: false,
plugins: [ new webpack.optimize.UglifyJsPlugin() ]
mode: "production",
performance: {
hints: false
}
}));

webpackConfigRelease[0].plugins.push(new ExtractTextPlugin({
filename: `./widgets/com/mendix/widget/custom/${name}/ui/${widgetName}.css`
}));

webpackConfigRelease[0].module.rules[1] = {
test: /\.s?css$/, loader: ExtractTextPlugin.extract({
fallback: "style-loader",
use: [ "css-loader", "sass-loader" ]
})
};

module.exports = function(grunt) {
const pkg = grunt.file.readJSON("package.json");
grunt.initConfig({
Expand All @@ -33,7 +53,7 @@ module.exports = function(grunt) {
expand: true,
date: new Date(),
store: false,
cwd: "./dist/tmp/src",
cwd: "./dist/tmp/widgets",
src: [ "**/*" ]
} ]
}
Expand All @@ -43,7 +63,7 @@ module.exports = function(grunt) {
distDeployment: {
files: [ {
dest: "./dist/MxTestProject/deployment/web/widgets",
cwd: "./dist/tmp/src/",
cwd: "./dist/tmp/widgets/",
src: [ "**/*" ],
expand: true
} ]
Expand All @@ -62,7 +82,7 @@ module.exports = function(grunt) {
addSourceURL: {
files: [ {
append: `\n\n//# sourceURL=${pkg.widgetName}.webmodeler.js\n`,
input: `dist/tmp/src/${pkg.widgetName}.webmodeler.js`
input: `dist/tmp/widgets/${pkg.widgetName}.webmodeler.js`
} ]
}
},
Expand Down Expand Up @@ -94,19 +114,19 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-contrib-compress");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-file-append");
grunt.loadNpmTasks("grunt-webpack");
grunt.loadNpmTasks("grunt-file-append");

grunt.registerTask("default", [ "clean build", "watch" ]);
grunt.registerTask(
"clean build",
"Compiles all the assets and copies the files to the dist directory.",
[ "checkDependencies", "clean:build", "webpack:develop", "file_append", "compress:dist", "copy:mpk" ]
[ "checkDependencies", "clean:build", "webpack:develop", "compress", "copy:mpk" ]
);
grunt.registerTask(
"release",
"Compiles all the assets and copies the files to the dist directory. Minified without source mapping",
[ "checkDependencies", "clean:build", "webpack:release", "file_append", "compress:dist", "copy:mpk" ]
[ "checkDependencies", "clean:build", "webpack:release", "file_append", "compress", "copy:mpk" ]
);
grunt.registerTask("build", [ "clean build" ]);
};
Loading

0 comments on commit 984ab67

Please sign in to comment.