Merge pull request #1113 from sharelatex/pr-compile-only-ol-dark-dev

Move LESS compilation process to Makefile

GitOrigin-RevId: 5a3871759eda2685ec0690899b0904d45c7db0a6
This commit is contained in:
Paulo Jorge Reis 2018-11-16 11:37:29 +00:00 committed by sharelatex
parent b3a957b8d8
commit 02eb683298
7 changed files with 55 additions and 14 deletions

View file

@ -64,16 +64,15 @@ public/js/modules/
public/js/services/
public/js/utils/
public/stylesheets/style.css
public/stylesheets/ol-style.css
public/stylesheets/ol-light-style.css
public/stylesheets/style*.css
public/stylesheets/ol-style*.css
public/stylesheets/ol-light-style*.css
public/stylesheets/ol-ieee-style*.css
public/stylesheets/*.map
public/minjs/
Gemfile.lock
public/stylesheets/ol-style.*.css
public/stylesheets/style.*.css
public/js/libs/require*.js

View file

@ -8,6 +8,8 @@ MODULE_MAKEFILES := $(MODULE_DIRS:=/Makefile)
COFFEE := node_modules/.bin/coffee $(COFFEE_OPTIONS)
BABEL := node_modules/.bin/babel
GRUNT := node_modules/.bin/grunt
LESSC := node_modules/.bin/lessc
CLEANCSS := node_modules/.bin/cleancss
APP_COFFEE_FILES := $(shell find app/coffee -name '*.coffee')
FRONT_END_SRC_FILES := $(shell find public/src -name '*.js')
@ -20,7 +22,19 @@ SRC_FILES := $(FRONT_END_SRC_FILES) $(TEST_SRC_FILES)
JS_FILES := $(subst coffee,js,$(COFFEE_FILES))
OUTPUT_SRC_FILES := $(subst src,js,$(SRC_FILES))
LESS_FILES := $(shell find public/stylesheets -name '*.less')
CSS_FILES := public/stylesheets/style.css public/stylesheets/ol-style.css public/stylesheets/ol-light-style.css
LESSC_COMMON_FLAGS := --source-map --autoprefix="last 2 versions, ie >= 10"
CLEANCSS_FLAGS := --s0 --source-map
LESS_SL_FILE := public/stylesheets/style.less
CSS_SL_FILE := public/stylesheets/style.css
LESS_OL_FILE := public/stylesheets/ol-style.less
CSS_OL_FILE := public/stylesheets/ol-style.css
LESS_OL_LIGHT_FILE := public/stylesheets/ol-light-style.less
CSS_OL_LIGHT_FILE := public/stylesheets/ol-light-style.css
LESS_OL_IEEE_FILE := public/stylesheets/ol-ieee-style.less
CSS_OL_IEEE_FILE := public/stylesheets/ol-ieee-style.css
CSS_FILES := $(CSS_SL_FILE) $(CSS_OL_FILE) $(CSS_OL_LIGHT_FILE) $(CSS_OL_IEEE_FILE)
# The automatic variable $(@D) is the target directory name
app.js: app.coffee
@ -81,18 +95,27 @@ public/js/main.js: public/src/main.js $(MODULE_MAIN_SRC_FILES)
sed -e s=\'__MAIN_CLIENTSIDE_INCLUDES__\'=$$INCLUDES= \
> $@
$(CSS_FILES): $(LESS_FILES)
$(GRUNT) compile:css
public/stylesheets/%.css: $(LESS_FILES)
$(LESSC) $(LESSC_COMMON_FLAGS) $(@D)/$*.less $(@D)/$*.css
css_full: $(CSS_FILES)
css: $(CSS_OL_FILE)
minify: $(CSS_FILES) $(JS_FILES) $(OUTPUT_SRC_FILES)
$(GRUNT) compile:minify
$(MAKE) minify_css
$(MAKE) minify_es
minify_css: $(CSS_FILES)
$(CLEANCSS) $(CLEANCSS_FLAGS) -o $(CSS_SL_FILE) $(CSS_SL_FILE)
$(CLEANCSS) $(CLEANCSS_FLAGS) -o $(CSS_OL_FILE) $(CSS_OL_FILE)
$(CLEANCSS) $(CLEANCSS_FLAGS) -o $(CSS_OL_LIGHT_FILE) $(CSS_OL_LIGHT_FILE)
$(CLEANCSS) $(CLEANCSS_FLAGS) -o $(CSS_OL_IEEE_FILE) $(CSS_OL_IEEE_FILE)
minify_es:
npm -q run webpack:production
css: $(CSS_FILES)
compile: $(JS_FILES) $(OUTPUT_SRC_FILES) css public/js/main.js public/js/ide.js
@$(MAKE) compile_modules
@ -105,7 +128,7 @@ compile_full:
$(COFFEE) -o test/unit/js -c test/unit/coffee
$(BABEL) test/unit_frontend/src --out-dir test/unit_frontend/js
rm -f public/js/ide.js public/js/main.js # We need to generate ide.js, main.js manually later
$(MAKE) $(CSS_FILES)
$(MAKE) css_full
$(MAKE) compile_modules_full
$(MAKE) compile # ide.js, main.js, share.js, and anything missed

View file

@ -119,7 +119,7 @@
"bunyan": "0.22.1",
"chai": "3.5.0",
"chai-spies": "",
"clean-css": "^3.4.18",
"clean-css-cli": "^4.2.1",
"coffee-script": "^1.7.1",
"es6-promise": "^4.0.5",
"eslint": "^4.18.1",
@ -143,7 +143,6 @@
"grunt-cli": "^1.2.0",
"grunt-contrib-clean": "0.5.0",
"grunt-contrib-coffee": "0.10.0",
"grunt-contrib-less": "1.4.x",
"grunt-contrib-requirejs": "0.4.1",
"grunt-contrib-watch": "^1.0.0",
"grunt-env": "0.4.4",
@ -155,7 +154,6 @@
"grunt-mocha-test": "0.9.0",
"grunt-newer": "^1.2.0",
"grunt-parallel": "^0.5.1",
"grunt-postcss": "^0.8.0",
"grunt-sed": "^0.1.1",
"grunt-shell": "^2.1.0",
"handlebars-loader": "^1.7.0",
@ -166,6 +164,8 @@
"karma-mocha-reporter": "^2.2.5",
"karma-requirejs": "^1.1.0",
"karma-webpack": "^2.0.9",
"less": "^2.7.3",
"less-plugin-autoprefix": "^2.0.0",
"mkdirp": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"nodemon": "^1.14.3",
"prettier-eslint-cli": "^4.7.1",

View file

@ -0,0 +1,6 @@
@import "ol-style.less";
@import "core/ol-light-variables.less";
@is-overleaf : true;
@is-overleaf-light : false;
@show-rich-text : true;

View file

@ -1,2 +1,6 @@
@import "ol-style.less";
@import "core/ol-light-variables.less";
@is-overleaf : true;
@is-overleaf-light : true;
@show-rich-text : true;

View file

@ -1,6 +1,10 @@
@import url(https://fonts.googleapis.com/css?family=Lato:300,400,700&subset=latin-ext);
@import url(https://fonts.googleapis.com/css?family=Merriweather:400,400i,700,700i);
@is-overleaf : true;
@is-overleaf-light : false;
@show-rich-text : true;
// Core variables and mixins
@import "core/ol-variables.less";
@import "app/ol-style-guide.less";

View file

@ -1,6 +1,11 @@
@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);
@import url(https://fonts.googleapis.com/css?family=Merriweather:400,400i,700,700i);
@is-overleaf : false;
@is-overleaf-light : false;
@show-rich-text : false;
// Core variables and mixins
@import "core/variables.less";
@import "_style_includes.less";