Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Clean up Grunt config, switch from less to sass

Paweł Kowalewski6e274319ea2e
diff --git a/Gruntfile.js b/Gruntfile.js
index d33fe3bb18..a96a184e06 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -24,16 +24,7 @@ module.exports = function(grunt) {
{
expand: true,
dot: true,
- cwd: "saleor/static/components/bootstrap/dist/js/",
- dest: "saleor/static/dist/js/",
- src: [
- "bootstrap.min.js"
- ]
- },
- {
- expand: true,
- dot: true,
- cwd: "saleor/static/components/bootstrap/fonts",
+ cwd: "saleor/static/components/bootstrap-sass/assets/fonts/bootstrap",
dest: "saleor/static/fonts/",
src: [
"*"
@@ -66,33 +57,6 @@ module.exports = function(grunt) {
"*"
]
},
- {
- expand: true,
- dot: true,
- cwd: "saleor/static/components/zocial-less/css",
- dest: "saleor/static/fonts/",
- src: [
- "zocial-regular-*"
- ]
- },
- {
- expand: true,
- dot: true,
- cwd: "saleor/static/components/less/dist/",
- dest: "saleor/static/dist/js/",
- src: [
- "less.min.js"
- ]
- },
- {
- expand: true,
- dot: true,
- cwd: "saleor/static/components/jquery/dist/",
- dest: "saleor/static/dist/js/",
- src: [
- "jquery.min.*"
- ]
- },
{
expand: true,
dot: true,
@@ -109,20 +73,6 @@ module.exports = function(grunt) {
]
}
},
- less: {
- production: {
- options: {
- compress: true,
- yuicompress: true,
- cleancss: true,
- optimization: 2
- },
- files: {
- "saleor/static/css/style.css": "saleor/static/less/style.less",
- "saleor/static/css/dashboard.css": "saleor/static/less/dashboard.less"
- }
- }
- },
postcss: {
options: {
map: true,
@@ -132,7 +82,10 @@ module.exports = function(grunt) {
]
},
prod: {
- src: "saleor/static/css/dashboard.css"
+ src: [
+ "saleor/static/css/storefront.css",
+ "saleor/static/css/dashboard.css"
+ ]
}
},
sass: {
@@ -142,6 +95,7 @@ module.exports = function(grunt) {
},
dist: {
files: {
+ "saleor/static/css/storefront.css": "saleor/static/scss/storefront.scss",
"saleor/static/css/dashboard.css": "saleor/static/scss/dashboard.scss"
}
}
@@ -159,12 +113,16 @@ module.exports = function(grunt) {
"saleor/static/components/materialize/dist/js/materialize.js",
"saleor/static/components/Sortable/Sortable.js",
"saleor/static/components/select2/dist/js/select2.js",
- "saleor/static/js_src/dashboard.js",
"saleor/static/components/dotdotdot/src/js/jquery.dotdotdot.js",
- "saleor/static/components/jquery.equalheights/jquery.equalheights.js"
+ "saleor/static/components/jquery.equalheights/jquery.equalheights.js",
+ "saleor/static/js_src/dashboard.js"
],
"saleor/static/js/dashboard-head.js": [
"saleor/static/components/modernizr/modernizr.js"
+ ],
+ "saleor/static/js/storefront.js": [
+ "saleor/static/components/jquery/dist/jquery.js",
+ "saleor/static/components/bootstrap-sass/assets/javascripts/bootstrap.js"
]
}
}
@@ -189,7 +147,7 @@ module.exports = function(grunt) {
require("load-grunt-tasks")(grunt);
- grunt.registerTask("default", ["copy", "less", "sass", "postcss", "uglify"]);
+ grunt.registerTask("default", ["copy", "sass", "postcss", "uglify"]);
grunt.registerTask("sync", ["browserSync", "watch"]);
- grunt.registerTask("heroku", ["copy", "less", "sass", "postcss", "uglify"]);
+ grunt.registerTask("heroku", ["copy", "sass", "postcss", "uglify"]);
};
diff --git a/bower.json b/bower.json
index accfb0d4b0..f50db87ec9 100644
--- a/bower.json
+++ b/bower.json
@@ -8,7 +8,6 @@
"license": "BSD",
"devDependencies": {
"less": "~2.4.0",
- "bootstrap": "~3.3.2",
"components-font-awesome": "~4.3.0",
"zocial-less": "~1.0.0",
"materialize": "~0.97.0",
@@ -18,6 +17,7 @@
"dropzone": "~4.0.1",
"dotdotdot": "~1.7.3",
"jquery.equalheights": "~1.5.2",
- "modernizr": "~2.8.3"
+ "modernizr": "~2.8.3",
+ "bootstrap-sass": "~3.3.5"
}
}
diff --git a/saleor/static/js_src/storefront.js b/saleor/static/js_src/storefront.js
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scss
index b8ad406601..9b7e5bfff5 100644
--- a/saleor/static/scss/_app.scss
+++ b/saleor/static/scss/_app.scss
@@ -1,325 +1,44 @@
-$roboto-font-path: "../fonts/";
-$icons-font-path: $roboto-font-path;
+$icon-font-path: "../fonts/";
+@import "bootstrap-sass/assets/stylesheets/bootstrap";
-$font-size-action-icon: 18px;
-$header-height: 60px;
-$transition-duration: .2s;
-
-@import "materialize/sass/materialize";
-@import "select2/src/scss/core";
-@import "vendor/basic";
-@import "vendor/dropzone";
-
-.header {
- @media (min-width: $large-screen-up) {
- margin-left: 240px;
- }
-
- .top-nav {
- box-shadow: none;
- height: $header-height;
- margin-bottom: $gutter-width;
-
- .container {
- height: 100%;
- }
-
- .header-button {
- float: left;
- margin-right: $gutter-width;
-
- @media (min-width: $medium-screen-up) {
- display: none;
- }
-
- i {
- font-size: 2.7rem;
- height: $header-height;
- line-height: $header-height;
- }
- }
-
- .dropdown-button {
- float: right;
- line-height: $header-height/2;
- position: relative;
- top: $header-height/4;
-
- i {
- height: $header-height/2;
- line-height: $header-height/2;
- }
- }
-
- .dropdown-content {
- left: auto !important;
- right: 0;
- white-space: nowrap;
- }
- }
-
- .side-nav {
- padding-top: $header-height;
-
- li {
- display: block;
- padding: 0;
-
- &:after {
- @extend .divider;
- content: "";
- display: block;
- }
-
- li:after {
- content: none;
- }
-
- .body-home &.nav-home {
- @extend .active;
- }
-
- @each $submodule in (products, attributes, categories, orders, payments, customers) {
- .body-#{$submodule} &.subnav-#{$submodule} {
- @extend .active;
-
- a {
- background-color: map_get($materialize-red, lighten-2);
- }
- }
- }
-
- &.brand-logo {
- top: 0;
- width: 100%;
-
- &:hover {
- background: none;
- }
-
- &:after {
- content: none;
- }
-
- a {
- display: block;
- height: $header-height;
- padding: 0;
- text-align: center;
-
- img {
- height: 100%;
- padding: 15px 0;
- }
- }
- }
-
- &.side-nav-user {
- a {
- font-size: 14px;
- line-height: 64px;
- margin: 0;
-
- i {
- vertical-align: inherit;
- width: auto;
- margin: 0 5px;
-
- &:last-child {
- margin-right: 0;
- }
- }
- }
-
- ul ul {
- li {
- a {
- line-height: 52px;
- }
- }
- }
- }
-
- ul ul {
- li {
- a {
- background: map-get($grey, lighten-5);
- height: 52px;
- line-height: 52px;
- padding-left: 30px;
- transition: background-color $transition-duration;
-
- &:hover, &:focus {
- background-color: #ddd;
- }
- }
- }
- }
-
- .collapsible-header {
- margin: 0;
- }
-
- .collapsible-body {
- a {
- margin: 0;
- }
- }
-
- i {
- display: inline-block;
- float: none;
- }
- }
-
- > li {
- &:hover {
- background: none;
- }
- }
- }
-}
-
-.main {
- @media (min-width: $large-screen-up) {
- margin-left: 240px;
- }
-}
-
-.container {
- @media (min-width: $large-screen-up) {
- width: 85%;
- }
-}
-
-.modal-content {
- .row {
- margin: {
- left: -.75rem;
- right: -.75rem;
- }
- }
-}
-
-.page-title {
- display: block;
- font-size: $h5-fontsize;
- line-height: $header-height;
-
- @media (max-width: $medium-screen) {
- float: right;
- width: calc(100% - 38px - 1.5rem);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-}
-
-table {
- .row {
- .col {
- float: none;
- padding: $gutter-width/2;
-
- .responsive-img {
- display: block;
- }
- }
- }
-}
-
-.input-with-suffix input {
- float: left;
- width: calc(100% - 40px);
-}
-
-.input-text-suffix {
- float: right;
- line-height: 45px;
- text-align: right;
- width: 40px;
+.navbar {
+ margin-bottom: 50px;
}
-#modal-product-class {
- max-width: 300px;
+.price {
+ &.undiscounted {
+ text-decoration: line-through;
+ }
}
-.pagination li.disabled span {
- color: #999;
+.address-details {
+ border-bottom: 1px dashed;
+ color: #3a87ad;
+ cursor: pointer;
}
-.btn-data-table {
- background: none;
- border: none;
- font-weight: bold;
- padding: 0;
- text-transform: uppercase;
-
- &:hover, &:focus {
- background: none;
- }
+.popover {
+ min-width: 200px;
}
-.fixed-action-btn {
- padding: 0;
+.product-gallery {
+ margin-top: $grid-gutter-width;
}
-.btn-fab {
- transition: transform $transition-duration, box-shadow $transition-duration;
-
- i {
- &:before {
- transition: font-size $transition-duration;
- }
- }
+.product-related {
+ .active {
+ border: 1px solid $btn-primary-border;
+ box-shadow: 0 0 5px $btn-primary-border;
+ }
}
-.btn-fab.btn-fab-hidden {
- transform: scaleX(0) scaleY(0);
-
- i {
- &:before {
- font-size: 0;
- }
- }
+.product-form {
+ .btn-group {
+ display: block;
+ overflow: hidden;
+ }
}
-.card {
- img {
- display: block;
-
- @media (max-width: $small-screen) {
- width: 100%;
- }
- }
+.form-group.required .control-label:after{
+ content: '*';
}
-
-.no-margin {
- margin: 0;
-}
-
-.switch-two-columns {
- @media (min-width: $large-screen) {
- float: left !important;
-
- &:first-child {
- float: right !important;
- }
- }
-}
-
-.text-lg {
- font-size: 120%;
-}
-
-@import "widget/breadcrumbs";
-@import "widget/card";
-@import "widget/data-table";
-@import "widget/dropzone";
-@import "widget/form";
-@import "widget/list";
-@import "widget/product-gallery";
-@import "widget/ppoi";
-@import "widget/select2";
-@import "widget/tabs";
-@import "widget/toast";
diff --git a/saleor/static/scss/_app_dashboard.scss b/saleor/static/scss/_app_dashboard.scss
new file mode 100644
index 0000000000..b8ad406601
--- /dev/null
+++ b/saleor/static/scss/_app_dashboard.scss
@@ -0,0 +1,325 @@
+$roboto-font-path: "../fonts/";
+$icons-font-path: $roboto-font-path;
+
+$font-size-action-icon: 18px;
+$header-height: 60px;
+$transition-duration: .2s;
+
+@import "materialize/sass/materialize";
+@import "select2/src/scss/core";
+@import "vendor/basic";
+@import "vendor/dropzone";
+
+.header {
+ @media (min-width: $large-screen-up) {
+ margin-left: 240px;
+ }
+
+ .top-nav {
+ box-shadow: none;
+ height: $header-height;
+ margin-bottom: $gutter-width;
+
+ .container {
+ height: 100%;
+ }
+
+ .header-button {
+ float: left;
+ margin-right: $gutter-width;
+
+ @media (min-width: $medium-screen-up) {
+ display: none;
+ }
+
+ i {
+ font-size: 2.7rem;
+ height: $header-height;
+ line-height: $header-height;
+ }
+ }
+
+ .dropdown-button {
+ float: right;
+ line-height: $header-height/2;
+ position: relative;
+ top: $header-height/4;
+
+ i {
+ height: $header-height/2;
+ line-height: $header-height/2;
+ }
+ }
+
+ .dropdown-content {
+ left: auto !important;
+ right: 0;
+ white-space: nowrap;
+ }
+ }
+
+ .side-nav {
+ padding-top: $header-height;
+
+ li {
+ display: block;
+ padding: 0;
+
+ &:after {
+ @extend .divider;
+ content: "";
+ display: block;
+ }
+
+ li:after {
+ content: none;
+ }
+
+ .body-home &.nav-home {
+ @extend .active;
+ }
+
+ @each $submodule in (products, attributes, categories, orders, payments, customers) {
+ .body-#{$submodule} &.subnav-#{$submodule} {
+ @extend .active;
+
+ a {
+ background-color: map_get($materialize-red, lighten-2);
+ }
+ }
+ }
+
+ &.brand-logo {
+ top: 0;
+ width: 100%;
+
+ &:hover {
+ background: none;
+ }
+
+ &:after {
+ content: none;
+ }
+
+ a {
+ display: block;
+ height: $header-height;
+ padding: 0;
+ text-align: center;
+
+ img {
+ height: 100%;
+ padding: 15px 0;
+ }
+ }
+ }
+
+ &.side-nav-user {
+ a {
+ font-size: 14px;
+ line-height: 64px;
+ margin: 0;
+
+ i {
+ vertical-align: inherit;
+ width: auto;
+ margin: 0 5px;
+
+ &:last-child {
+ margin-right: 0;
+ }
+ }
+ }
+
+ ul ul {
+ li {
+ a {
+ line-height: 52px;
+ }
+ }
+ }
+ }
+
+ ul ul {
+ li {
+ a {
+ background: map-get($grey, lighten-5);
+ height: 52px;
+ line-height: 52px;
+ padding-left: 30px;
+ transition: background-color $transition-duration;
+
+ &:hover, &:focus {
+ background-color: #ddd;
+ }
+ }
+ }
+ }
+
+ .collapsible-header {
+ margin: 0;
+ }
+
+ .collapsible-body {
+ a {
+ margin: 0;
+ }
+ }
+
+ i {
+ display: inline-block;
+ float: none;
+ }
+ }
+
+ > li {
+ &:hover {
+ background: none;
+ }
+ }
+ }
+}
+
+.main {
+ @media (min-width: $large-screen-up) {
+ margin-left: 240px;
+ }
+}
+
+.container {
+ @media (min-width: $large-screen-up) {
+ width: 85%;
+ }
+}
+
+.modal-content {
+ .row {
+ margin: {
+ left: -.75rem;
+ right: -.75rem;
+ }
+ }
+}
+
+.page-title {
+ display: block;
+ font-size: $h5-fontsize;
+ line-height: $header-height;
+
+ @media (max-width: $medium-screen) {
+ float: right;
+ width: calc(100% - 38px - 1.5rem);
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+}
+
+table {
+ .row {
+ .col {
+ float: none;
+ padding: $gutter-width/2;
+
+ .responsive-img {
+ display: block;
+ }
+ }
+ }
+}
+
+.input-with-suffix input {
+ float: left;
+ width: calc(100% - 40px);
+}
+
+.input-text-suffix {
+ float: right;
+ line-height: 45px;
+ text-align: right;
+ width: 40px;
+}
+
+#modal-product-class {
+ max-width: 300px;
+}
+
+.pagination li.disabled span {
+ color: #999;
+}
+
+.btn-data-table {
+ background: none;
+ border: none;
+ font-weight: bold;
+ padding: 0;
+ text-transform: uppercase;
+
+ &:hover, &:focus {
+ background: none;
+ }
+}
+
+.fixed-action-btn {
+ padding: 0;
+}
+
+.btn-fab {
+ transition: transform $transition-duration, box-shadow $transition-duration;
+
+ i {
+ &:before {
+ transition: font-size $transition-duration;
+ }
+ }
+}
+
+.btn-fab.btn-fab-hidden {
+ transform: scaleX(0) scaleY(0);
+
+ i {
+ &:before {
+ font-size: 0;
+ }
+ }
+}
+
+.card {
+ img {
+ display: block;
+
+ @media (max-width: $small-screen) {
+ width: 100%;
+ }
+ }
+}
+
+.no-margin {
+ margin: 0;
+}
+
+.switch-two-columns {
+ @media (min-width: $large-screen) {
+ float: left !important;
+
+ &:first-child {
+ float: right !important;
+ }
+ }
+}
+
+.text-lg {
+ font-size: 120%;
+}
+
+@import "widget/breadcrumbs";
+@import "widget/card";
+@import "widget/data-table";
+@import "widget/dropzone";
+@import "widget/form";
+@import "widget/list";
+@import "widget/product-gallery";
+@import "widget/ppoi";
+@import "widget/select2";
+@import "widget/tabs";
+@import "widget/toast";
diff --git a/saleor/static/scss/dashboard.scss b/saleor/static/scss/dashboard.scss
index 78d17dd03e..154d1b9745 100644
--- a/saleor/static/scss/dashboard.scss
+++ b/saleor/static/scss/dashboard.scss
@@ -1 +1 @@
-@import "app";
+@import "app_dashboard";
diff --git a/saleor/static/scss/storefront.scss b/saleor/static/scss/storefront.scss
new file mode 100644
index 0000000000..aea8abd85d
--- /dev/null
+++ b/saleor/static/scss/storefront.scss
@@ -0,0 +1 @@
+@import "app";
\ No newline at end of file
diff --git a/templates/base.html b/templates/base.html
index 94e74714fe..fe573ba5b7 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -140,8 +140,7 @@
{% endblock %}
{% block third-party-js %}{% endblock third-party-js %}
{% block footer_scripts %}
- <script src="{% static "dist/js/jquery.min.js" %}"></script>
- <script src="{% static "dist/js/bootstrap.min.js" %}"></script>
+ <script src="{% static "js/storefront.js" %}"></script>
{% endblock footer_scripts %}
</body>
</html>