From 14be48aaf097454dcf8a62cc0604828504a67128 Mon Sep 17 00:00:00 2001 From: Michel Felipe Date: Tue, 28 Jun 2016 17:25:12 -0300 Subject: [PATCH] Fix 'scss' skin path and 'angular-default' theme verification error --- README.md | 4 ++-- gulp/conf.js | 36 ++++++++++++++++++++++++++---------- themes/angular-participa-consulta/app/layout/scss/skins/_yellow.scss | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ themes/angular-participa-consulta/app/layout/skins/_yellow.scss | 56 -------------------------------------------------------- 4 files changed, 84 insertions(+), 68 deletions(-) create mode 100644 themes/angular-participa-consulta/app/layout/scss/skins/_yellow.scss delete mode 100644 themes/angular-participa-consulta/app/layout/skins/_yellow.scss diff --git a/README.md b/README.md index 342202a..99fd179 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,9 @@ See some important folders bellow: **N.B.** -1-The full name of the scss class should be used as the parameter for the command `npm config set angular-theme:`, like in _skin-mycustom_. DO NOT use the file name of the skin as the parameter. +1. The full name of the scss class should be used as the parameter for the command `npm config set angular-theme:`, like in _skin-mycustom_. DO NOT use the file name of the skin as the parameter. -2-The skin's file should be the named as the scss class without the word `skin`, preceded by an underline. Otherwise it will raise an error during `npm install`. +2. The skin's file should be the named as the scss class without the word `skin`, preceded by an underline. Otherwise, it will raise an error during `npm install`. Example: _mycustom. diff --git a/gulp/conf.js b/gulp/conf.js index 4742691..7906f0f 100644 --- a/gulp/conf.js +++ b/gulp/conf.js @@ -44,18 +44,34 @@ exports.themeExists = function (path) { * @param skin The skin name passed by arg to gulp task */ exports.skinExists = function (skin) { - var skinFile = skin+'.scss'; - if(/skin-/.test(skin)){ - skinFile = skin.replace('skin-','_')+'.scss'; - } - var skinPath = path.join(exports.paths.themes, exports.paths.theme, '/app/layout/skins/', skinFile); + var skinPath, prefixPath = ''; + var skinFile = skin+'.scss'; + if (/skin-/.test(skin)) { + skinFile = skin.replace('skin-','_')+'.scss'; + } + + if (/-default$/.test(exports.paths.theme)) { + prefixPath = exports.paths.src; + }else { + prefixPath = path.join(exports.paths.themes, exports.paths.theme); + } + + skinPath = path.join(prefixPath, '/app/layout/scss/skins/', skinFile); + + try { + fs.statSync(skinPath); + } catch(e) { + throw new Error('The skin file "'+skinPath+'" was not found'); + } + + var content = fs.readFileSync(skinPath, {encoding: 'utf8'}); + if(content.search(skin) == -1) { + throw new Error('The skin css selector ".'+skin+'" was not found in "'+skinPath+'" file'); + }else if (content.search('@extend %skin-base') == -1) { + throw new Error('The skin css selector ".'+skin+'" needs inherit from %skin-base sass placeholder'); + } - try { - fs.statSync(skinPath); - }catch(e) { - throw new Error('The skin "'+skin+'" was not found in "'+skinPath+'"'); - } }; exports.configTheme = function(theme) { diff --git a/themes/angular-participa-consulta/app/layout/scss/skins/_yellow.scss b/themes/angular-participa-consulta/app/layout/scss/skins/_yellow.scss new file mode 100644 index 0000000..58947ea --- /dev/null +++ b/themes/angular-participa-consulta/app/layout/scss/skins/_yellow.scss @@ -0,0 +1,56 @@ +.skin-yellow { + @extend %skin-base; + + .notifications-list .item-footer { + background: #DAE1C4; + color: #4F9CAC; + } + + .navbar-nav .open > a, + .navbar-nav .open > a:hover, + .navbar-nav .open > a:focus { + background-color: $selected-color; + color: #000; + } + + .nav .open > a, + .nav .open > a:hover, + .nav .open > a:focus { + border: none; + } + + .dropdown-menu { + li > a:hover { + color: #555; + background-color: #F7F7F7; + } + + .active > a, + .active > a:hover, + .active > a:focus { + color: #000; + background-color: #CCC; + } + } + + .nav .caret { + border-bottom-color: #fff !important; + border-top-color: #fff !important; + } + + .nav .open .caret { + border-bottom-color: #000 !important; + border-top-color: #000 !important; + } + + .navbar-inverse .navbar-toggle { + border-color: #D49F18; + } + + .container-fluid .navbar-header .navbar-toggle { + &:hover, &:focus { + background-color: #f5b025; + } + } + +} diff --git a/themes/angular-participa-consulta/app/layout/skins/_yellow.scss b/themes/angular-participa-consulta/app/layout/skins/_yellow.scss deleted file mode 100644 index 58947ea..0000000 --- a/themes/angular-participa-consulta/app/layout/skins/_yellow.scss +++ /dev/null @@ -1,56 +0,0 @@ -.skin-yellow { - @extend %skin-base; - - .notifications-list .item-footer { - background: #DAE1C4; - color: #4F9CAC; - } - - .navbar-nav .open > a, - .navbar-nav .open > a:hover, - .navbar-nav .open > a:focus { - background-color: $selected-color; - color: #000; - } - - .nav .open > a, - .nav .open > a:hover, - .nav .open > a:focus { - border: none; - } - - .dropdown-menu { - li > a:hover { - color: #555; - background-color: #F7F7F7; - } - - .active > a, - .active > a:hover, - .active > a:focus { - color: #000; - background-color: #CCC; - } - } - - .nav .caret { - border-bottom-color: #fff !important; - border-top-color: #fff !important; - } - - .nav .open .caret { - border-bottom-color: #000 !important; - border-top-color: #000 !important; - } - - .navbar-inverse .navbar-toggle { - border-color: #D49F18; - } - - .container-fluid .navbar-header .navbar-toggle { - &:hover, &:focus { - background-color: #f5b025; - } - } - -} -- libgit2 0.21.2