2014-02-12 10:23:40 +00:00
|
|
|
fs = require "fs"
|
2016-09-22 10:02:20 +00:00
|
|
|
PackageVersions = require "./app/coffee/infrastructure/PackageVersions"
|
2018-02-06 14:04:28 +00:00
|
|
|
Settings = require "settings-sharelatex"
|
2017-01-18 15:38:18 +00:00
|
|
|
require('es6-promise').polyfill()
|
2014-02-12 10:23:40 +00:00
|
|
|
|
|
|
|
module.exports = (grunt) ->
|
|
|
|
grunt.loadNpmTasks 'grunt-contrib-requirejs'
|
2015-10-09 09:11:38 +00:00
|
|
|
grunt.loadNpmTasks 'grunt-file-append'
|
|
|
|
|
2014-09-08 13:19:24 +00:00
|
|
|
config =
|
2016-06-15 11:08:11 +00:00
|
|
|
|
2014-02-12 10:23:40 +00:00
|
|
|
requirejs:
|
|
|
|
compile:
|
|
|
|
options:
|
2014-06-16 17:29:55 +00:00
|
|
|
optimize:"uglify2"
|
|
|
|
uglify2:
|
|
|
|
mangle: false
|
2014-02-12 10:23:40 +00:00
|
|
|
appDir: "public/js"
|
|
|
|
baseUrl: "./"
|
|
|
|
dir: "public/minjs"
|
|
|
|
inlineText: false
|
2017-06-26 15:14:03 +00:00
|
|
|
generateSourceMaps: true
|
2014-02-12 10:23:40 +00:00
|
|
|
preserveLicenseComments: false
|
|
|
|
paths:
|
2016-09-22 10:36:53 +00:00
|
|
|
"moment": "libs/#{PackageVersions.lib('moment')}"
|
2015-01-29 18:11:38 +00:00
|
|
|
"mathjax": "/js/libs/mathjax/MathJax.js?config=TeX-AMS_HTML"
|
2016-10-13 13:51:21 +00:00
|
|
|
"pdfjs-dist/build/pdf": "libs/#{PackageVersions.lib('pdfjs')}/pdf"
|
2016-10-12 08:52:15 +00:00
|
|
|
"ace": "#{PackageVersions.lib('ace')}"
|
2017-12-01 11:22:41 +00:00
|
|
|
"fineuploader": "libs/#{PackageVersions.lib('fineuploader')}"
|
2014-02-12 10:23:40 +00:00
|
|
|
shim:
|
2016-10-13 13:51:21 +00:00
|
|
|
"pdfjs-dist/build/pdf":
|
2016-09-22 10:36:53 +00:00
|
|
|
deps: ["libs/#{PackageVersions.lib('pdfjs')}/compatibility"]
|
2014-02-12 10:23:40 +00:00
|
|
|
|
|
|
|
skipDirOptimize: true
|
|
|
|
modules: [
|
|
|
|
{
|
|
|
|
name: "main",
|
2017-12-13 17:07:58 +00:00
|
|
|
exclude: ["libraries"]
|
2014-02-12 10:23:40 +00:00
|
|
|
}, {
|
|
|
|
name: "ide",
|
2017-12-13 17:07:58 +00:00
|
|
|
exclude: ["pdfjs-dist/build/pdf", "libraries"]
|
2017-12-13 14:19:19 +00:00
|
|
|
},{
|
2017-12-13 17:07:58 +00:00
|
|
|
name: "libraries"
|
2014-11-04 12:01:53 +00:00
|
|
|
},{
|
|
|
|
name: "ace/mode-latex"
|
2016-09-14 14:17:24 +00:00
|
|
|
},{
|
|
|
|
name: "ace/worker-latex"
|
2014-02-12 10:23:40 +00:00
|
|
|
}
|
2014-11-04 12:01:53 +00:00
|
|
|
|
2014-02-12 10:23:40 +00:00
|
|
|
]
|
|
|
|
|
2015-10-09 09:11:38 +00:00
|
|
|
file_append:
|
|
|
|
default_options: files: [ {
|
|
|
|
append: '\n//ide.js is complete - used for automated testing'
|
|
|
|
input: 'public/minjs/ide.js'
|
|
|
|
output: 'public/minjs/ide.js'
|
|
|
|
}]
|
|
|
|
|
2014-09-08 13:19:24 +00:00
|
|
|
grunt.initConfig config
|
2019-01-29 10:10:13 +00:00
|
|
|
grunt.registerTask 'compile:minify', 'Concat and minify the client side js', ['requirejs', "file_append"]
|
2015-11-18 15:21:48 +00:00
|
|
|
|