Commit 9488b1d57f567910fa23837b3aaddb59dceb03e4

Authored by Evandro Junior
1 parent 1fafb3da
Exists in staging

Revert "Merge branch 'master' into staging"

This reverts commit 9f3edb4c7f9f085bd20c597e3e40086cee659ea7, reversing
changes made to 166d39f061f8e8ad05990ff4591d10678a9083c1.
README.md
... ... @@ -53,7 +53,7 @@ See some important folders bellow:
53 53  
54 54 ## Change skin
55 55  
56   -- Create an any scss file into: `app/layout/scss/skins/`
  56 +- Create an any scss file into: `app/layout/skins/`
57 57 > **Suggestion:** Create a `sass` file partial. Something like: **`_mycustom.scss`**.
58 58  
59 59 - Extend your skin css class from `%skin-base` scss placeholder selector. Something like this:
... ... @@ -66,14 +66,6 @@ See some important folders bellow:
66 66 ```
67 67 - Configure application to use the new theme, e.g.:
68 68 `npm config set angular-theme:skin skin-mycustom`
69   -OR add the default skin property to a specific `package.json` file (ONLY PERFORM A BUILD), like this:
70   -
71   -```json
72   -"config": {
73   - "skin": "skin-yellow"
74   -}
75   -```
76   -
77 69  
78 70 **N.B.**
79 71  
... ...
gulp/build.js
... ... @@ -154,8 +154,4 @@ gulp.task('noosfero', ['html'], function () {
154 154 return merge(layouts, theme, index);
155 155 });
156 156  
157   -gulp.task('inject-skin-build', ['html'], function () {
158   - gulp.start('inject-skin');
159   -});
160   -
161   -gulp.task('build', ['ckeditor', 'html', 'fonts', 'other', 'locale', 'plugin-languages', 'noosfero', 'inject-skin-build']);
  157 +gulp.task('build', ['ckeditor', 'html', 'fonts', 'other', 'locale', 'plugin-languages', 'noosfero']);
... ...
gulp/conf.js
... ... @@ -9,7 +9,7 @@
9 9 var argv = require('minimist')(process.argv.slice(2));
10 10 var gutil = require('gulp-util');
11 11 var path = require('path');
12   -var fs = require('fs-extra');
  12 +var fs = require('fs');
13 13  
14 14 /**
15 15 * The main paths of your project handle these with care
... ... @@ -25,17 +25,6 @@ exports.paths = {
25 25 languages: 'languages'
26 26 };
27 27  
28   -exports.isBuild = function () {
29   - if (!exports.building) {
30   - exports.building = (argv._[0] == 'build' ? true : false);
31   - }
32   - return exports.building;
33   -};
34   -
35   -exports.isDefaultTheme = function (name) {
36   - return /-default$/.test(name);
37   -};
38   -
39 28 /**
40 29 * Check if theme folder exists on "themes" directory
41 30 *
... ... @@ -56,18 +45,13 @@ exports.themeExists = function (path) {
56 45 */
57 46 exports.skinExists = function (skin) {
58 47  
59   - //Skip skin verification on 'build' task
60   - // if(exports.isBuild()){
61   - // return;
62   - // }
63   -
64 48 var skinPath, prefixPath = '';
65 49 var skinFile = skin+'.scss';
66 50 if (/skin-/.test(skin)) {
67 51 skinFile = skin.replace('skin-','_')+'.scss';
68 52 }
69 53  
70   - if (exports.isDefaultTheme(exports.paths.theme)) {
  54 + if (/-default$/.test(exports.paths.theme)) {
71 55 prefixPath = exports.paths.src;
72 56 }else {
73 57 prefixPath = path.join(exports.paths.themes, exports.paths.theme);
... ... @@ -82,7 +66,7 @@ exports.skinExists = function (skin) {
82 66 }
83 67  
84 68 var content = fs.readFileSync(skinPath, {encoding: 'utf8'});
85   - if (content.search(skin) == -1) {
  69 + if(content.search(skin) == -1) {
86 70 throw new Error('The skin css selector ".'+skin+'" was not found in "'+skinPath+'" file');
87 71 }else if (content.search('@extend %skin-base') == -1) {
88 72 throw new Error('The skin css selector ".'+skin+'" needs inherit from %skin-base sass placeholder');
... ... @@ -97,32 +81,15 @@ exports.configTheme = function(theme) {
97 81  
98 82 exports.paths.allSources = [exports.paths.src, themePath];
99 83  
  84 +
100 85 exports.themeExists(themePath);
101 86 exports.paths.dist = path.join("dist", exports.paths.theme);
102 87  
103   - if(exports.isBuild() && !exports.isDefaultTheme(exports.paths.theme)){
104   -
105   - try {
106   - fs.statSync(path.join(themePath,'package.json'));
107   - var themeData = fs.readJsonSync(path.join(themePath,'package.json'));
108   -
109   - if(!themeData.config || !themeData.config.skin) {
110   - throw new Error('The theme "'+exports.paths.theme+'" needs a default skin on their package.json file');
111   - }
112   - argv.skin = themeData.config.skin;
113   - } catch (e) {
114   - gutil.log(gutil.colors.yellow('[WARNING]','The package.json file was not found into theme:'), gutil.colors.cyan(exports.paths.theme));
115   - }
116   -
117   - }
118   -
119   - if(argv.skin && argv.skin != 'skin-whbl') {
  88 + if(argv.skin) {
120 89 exports.skinExists(argv.skin);
121 90  
122 91 exports.paths.skin = argv.skin;
123 92 }
124   -
125   - gutil.log('Configuring theme', gutil.colors.green(exports.paths.theme.toUpperCase()));
126 93 }
127 94 exports.configTheme(argv.theme);
128 95  
... ...
gulp/inject.js
... ... @@ -57,12 +57,7 @@ gulp.task('inject-skin', function () {
57 57  
58 58 if(conf.paths.skin) {
59 59  
60   - var jsPaths = {
61   - src: path.join(conf.paths.src,'./noosfero.js'),
62   - dest: conf.paths.src,
63   - };
64   -
65   - $.util.log('Configuring theme skin:', conf.paths.skin, '...');
  60 + $.util.log('Configured theme skin:', conf.paths.skin);
66 61  
67 62 var replaceSkin = transform(function(filename) {
68 63 return map(function(file, next) {
... ... @@ -72,14 +67,9 @@ gulp.task('inject-skin', function () {
72 67 });
73 68 });
74 69  
75   - if (conf.isBuild()) {
76   - jsPaths.src = path.join(conf.paths.dist, 'scripts', 'app-*.js');
77   - jsPaths.dest = path.join(conf.paths.dist, 'scripts');
78   - }
79   -
80   - gulp.src(jsPaths.src)
  70 + gulp.src(path.join(conf.paths.src,'./noosfero.js'))
81 71 .pipe(replaceSkin)
82   - .pipe(gulp.dest(jsPaths.dest));
  72 + .pipe(gulp.dest(conf.paths.src));
83 73 }
84 74  
85 75 });
... ...
package.json
... ... @@ -26,8 +26,7 @@
26 26 "postinstall": "bower install; typings install; cd dev-scripts; typings install; cd ../; npm run fix-jqlite",
27 27 "start": "concurrently \"webpack -w\" \"gulp --theme=$npm_package_config_theme --skin=$npm_package_config_skin serve\"",
28 28 "generate-indexes": "ts-node --project ./dev-scripts ./dev-scripts/generate-index-modules.ts",
29   - "fix-jqlite": "ts-node --project ./dev-scripts dev-scripts/fix-jqlite.ts",
30   - "debug-gulp": "webpack; gulp clean; ./node_modules/.bin/iron-node node_modules/gulp/bin/gulp.js --theme=$npm_package_config_theme --skin=$npm_package_config_skin"
  29 + "fix-jqlite": "ts-node --project ./dev-scripts dev-scripts/fix-jqlite.ts"
31 30 },
32 31 "devDependencies": {
33 32 "bower": "^1.7.7",
... ... @@ -40,7 +39,6 @@
40 39 "eslint-plugin-angular": "~0.12.0",
41 40 "estraverse": "~4.1.0",
42 41 "expose-loader": "^0.7.1",
43   - "fs-extra": "^0.30.0",
44 42 "glob": "^7.0.0",
45 43 "gulp": "^3.9.1",
46 44 "gulp-angular-filesort": "~1.1.1",
... ... @@ -71,7 +69,6 @@
71 69 "gulp-useref": "~1.3.0",
72 70 "gulp-util": "~3.0.6",
73 71 "http-proxy-middleware": "~0.9.0",
74   - "iron-node": "^3.0.7",
75 72 "istanbul": "^0.4.2",
76 73 "karma": "~0.13.10",
77 74 "karma-angular-filesort": "~1.0.0",
... ...
themes/angular-participa-consulta/README.md
... ... @@ -3,25 +3,8 @@
3 3  
4 4 ## Getting started
5 5  
6   -**1. To use with `npm start` command**
7   -> **PS:** To developer mode
8   -
9 6 Run these commands to set the proper theme and skin
10 7  
11 8 `npm config set angular-theme:theme angular-participa-consulta`
12 9  
13 10 `npm config set angular-theme:skin skin-yellow`
14   -
15   -**2. To generate a build**
16   -> **PS:** Deploy to production
17   -
18   -* Create a specific `package.json` file into this directory
19   -> Use the **`npm init`** command to create this file
20   -
21   -* Configure the **main** skin to this theme. Add the property `config['skin']` below:
22   -
23   -```json
24   -"config": {
25   - "skin": "skin-yellow"
26   -}
27   -```
... ...
themes/angular-participa-consulta/package.json
... ... @@ -1,14 +0,0 @@
1   -{
2   - "name": "angular-participa-consulta",
3   - "version": "1.0.0",
4   - "description": "The theme for 'Consulta publica' community specific colors and UI changes",
5   - "config": {
6   - "theme": "angular-participa-consulta",
7   - "skin": "skin-yellow"
8   - },
9   - "scripts": {
10   - "test": "echo \"Error: no test specified\" && exit 1"
11   - },
12   - "author": "",
13   - "license": "ISC"
14   -}