Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump update #15

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ theme.js
theme.min.js
config.json
assets/css/pre-build
assets/js/libs
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
app.js
theme.min.css
theme.min.js
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a prettier runner in grunt. it's not all IDE that will parse and correct the files and our stack should be IDE independent.

"useTabs": true,
"tabWidth": 4,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 100,
"semi": true,
"arrowParens": "always",
"endOfLine": "lf"
}
29 changes: 15 additions & 14 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const findUsedJsFiles = (grunt) => {
const file = grunt.file.read('snippets/js.liquid', 'utf8');
const file = grunt.file.read('snippets/js-modules.liquid', 'utf8');
const regex = /'([0-9a-zA-Z\-_\.]*.js)' \| asset_url/gm;

let jsFiles = [];
Expand Down Expand Up @@ -31,7 +31,6 @@ const findUsedJsLibs = (grunt) => {
};

module.exports = function (grunt) {

let shopifyConfig = grunt.file.readJSON('config.json', 'utf8');

grunt.initConfig({
Expand All @@ -41,8 +40,8 @@ module.exports = function (grunt) {
pkg: grunt.file.readJSON('package.json'),
install: {
options: {
env: ['default', 'staging', 'production']
}
env: ['default', 'staging', 'production'],
},
},
shopify: {
options: {
Expand All @@ -58,15 +57,15 @@ module.exports = function (grunt) {
'locales/*',
'sections/*',
'snippets/*',
'templates/*'
]
}
}
'templates/*',
],
},
},
});

const tasks = grunt.file.expand({ filter: 'isFile', cwd: 'tasks' }, ['*']);

tasks.forEach(task => {
tasks.forEach((task) => {
require(`./tasks/${task}`)(grunt);
});

Expand All @@ -79,22 +78,24 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-csso');
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-purgecss');
grunt.loadNpmTasks('grunt-csso');
grunt.loadNpmTasks('grunt-env');
grunt.loadNpmTasks('grunt-complexity');
grunt.loadNpmTasks('grunt-prettier');

grunt.registerTask('dev-js', ['complexity', 'jshint']);
grunt.registerTask('dev-js', ['complexity', 'prettier', 'jshint']);
grunt.registerTask('dev', ['dev-js']);

grunt.registerTask('js', ['dev-js', 'clean:js', 'libs', 'concat:js', 'babel', 'headers:js']);
grunt.registerTask('css', ['clean:css','postcss', 'concat:css', 'purgecss', 'csso', 'headers:css']);
grunt.registerTask('build', ['css', 'js']);
grunt.registerTask('css', ['clean:css', 'postcss', 'csso', 'headers:css']);
grunt.registerTask('build', ['env:build', 'css', 'js']);

grunt.registerTask('deploy', ['build', 'shopify:deploy']);
grunt.registerTask('deploy:staging', ['build', 'shopify:deploy:staging']);
grunt.registerTask('deploy:prod', ['build', 'shopify:deploy:production']);
grunt.registerTask('init', ['install', 'deploy']);

grunt.registerTask('default', ['watch']);
grunt.registerTask('default', ['env:dev', 'watch']);
};
6 changes: 2 additions & 4 deletions assets/css/base/fonts.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@

@font-face {
font-family: 'Font Name';
src: local('?'),
url("/assets/fonts/file-name.woff2") format('woff2'),
url("/assets/fonts/file-name.woff") format('woff');
src: local('?'), url('/assets/fonts/file-name.woff2') format('woff2'),
url('/assets/fonts/file-name.woff') format('woff');
font-weight: 400;
font-style: normal;
font-display: fallback;
Expand Down
36 changes: 23 additions & 13 deletions assets/css/base/site.css
Original file line number Diff line number Diff line change
@@ -1,33 +1,43 @@
::selection {
@apply bg-main-reverse;
@apply text-main-reverse;
@apply bg-black;
@apply text-white;
}
::-moz-selection {
@apply bg-main-reverse;
@apply text-main-reverse;
@apply bg-black;
@apply text-white;
}

@media screen and (prefers-reduced-motion: reduce), (update: slow) {
*,
*::before,
*::after {
animation-duration: 0.001ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001ms !important;
scroll-behavior: auto !important;
}
}

html {
--unit-root: 1;
--security-root: 60;
--fluid-breakpoint-root: 1560;
--perimeter-root: calc(
var(--fluid-breakpoint-root) - var(--security-root) * 2
);
--unit-in-vw: calc(
var(--unit-root) * 100 / var(--fluid-breakpoint-root) * 1vw
);
--perimeter-root: calc(var(--fluid-breakpoint-root) - var(--security-root) * 2);
--unit-in-vw: calc(var(--unit-root) * 100 / var(--fluid-breakpoint-root) * 1vw);
--unit-in-px: calc(var(--unit-root) * 1px);

--ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
--ease-out-quad: cubic-bezier(0.5, 1, 0.89, 1);

font-size: calc(var(--unit-in-vw) * 3);
scroll-behavior: smooth;

-webkit-font-smoothing: antialiased;
-webkit-tap-highlight-color: transparent;
}

body {
@apply text-current;
@apply font-sans;
@apply text-40;
@apply font-base;
}

/* Tablet */
Expand Down
3 changes: 0 additions & 3 deletions assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@

/* Utils */
@import 'tailwind/utilities.css';

/* Admin */
@import 'lib/admin.css';
61 changes: 1 addition & 60 deletions assets/js/core/app.js

Large diffs are not rendered by default.

24 changes: 13 additions & 11 deletions assets/js/modules/add-to-cart.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
/**
* add-to-cart
* @author Deux Huit Huit
*/
* add-to-cart
* @author Deux Huit Huit
*/
(function ($, undefined) {

'use strict';

var scope = $('body');

var sels = {
btn: '.js-add-to-cart',
qte: '.js-add-to-cart-qte'
qte: '.js-add-to-cart-qte',
};

var onVariantSelected = function (variant) {
var btn = scope.find(sels.btn);
btn.attr('data-id', variant.id);
btn.prop('disabled', !variant.available);
scope.find(sels.qte).val(1);
btn.text(!!variant.available ? btn.attr('data-available-text') : btn.attr('data-out-of-stock-text')); // jshint ignore:line
btn.text(
!!variant.available
? btn.attr('data-available-text')
: btn.attr('data-out-of-stock-text'),
); // jshint ignore:line
};

var onClick = function (event) {
Expand Down Expand Up @@ -52,7 +55,7 @@
},
complete: function () {
t.removeClass('is-loading');
}
},
});

return false;
Expand All @@ -65,12 +68,11 @@
App.register(function () {
return {
app: {
init: init
init: init,
},
variant: {
selected: onVariantSelected
}
selected: onVariantSelected,
},
};
});

})(jQuery);
14 changes: 6 additions & 8 deletions assets/js/modules/cart-count.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/**
* cart-count
* @author Deux Huit Huit
*/
* cart-count
* @author Deux Huit Huit
*/
(function ($, undefined) {

'use strict';

var scope = $('body');

var sels = {
item: '.js-cart-count'
item: '.js-cart-count',
};

var onCartUpdate = function (cart) {
Expand All @@ -19,9 +18,8 @@
App.register(function () {
return {
cart: {
update: onCartUpdate
}
update: onCartUpdate,
},
};
});

})(jQuery);
18 changes: 8 additions & 10 deletions assets/js/modules/cart-update-qte.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/**
* cart-update-qte
* @author Deux Huit Huit
*/
* cart-update-qte
* @author Deux Huit Huit
*/
(function ($, undefined) {

'use strict';

var scope = $('body');

var sels = {
qte: '.js-cart-qte',
btn: '.js-cart-qte-btn'
btn: '.js-cart-qte-btn',
};

var REQUEST_DELAY = 200;
Expand All @@ -23,11 +22,11 @@
dataType: 'json',
data: {
id: id,
quantity: qte
quantity: qte,
},
success: function (cart) {
App.notify('cart.forceUpdate', cart);
}
},
});
};

Expand Down Expand Up @@ -62,9 +61,8 @@
App.register(function () {
return {
app: {
init: init
}
init: init,
},
};
});

})(jQuery);
21 changes: 12 additions & 9 deletions assets/js/modules/cart-update.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/**
* cart-update
* @author Deux Huit Huit
*/
* cart-update
* @author Deux Huit Huit
*/
(function ($, undefined) {

'use strict';

var scope = $('body');
Expand All @@ -14,7 +13,7 @@
itemTotal: '.js-cart-item-total',
discount: '.js-cart-discounts',
discountCtn: '.js-cart-discounts-ctn',
qte: '.js-cart-qte'
qte: '.js-cart-qte',
};

var formatMoney = function (money) {
Expand All @@ -31,7 +30,12 @@
};

var onCartUpdate = function (cart) {
if (!cart.items.length && window.location.pathname === '/cart' && !!scope.find(sels.item).length) { // jshint ignore:line
if (
!cart.items.length &&
window.location.pathname === '/cart' &&
!!scope.find(sels.item).length
) {
// jshint ignore:line
window.location.reload();
return;
}
Expand Down Expand Up @@ -80,9 +84,8 @@
App.register(function () {
return {
cart: {
update: onCartUpdate
}
update: onCartUpdate,
},
};
});

})(jQuery);
16 changes: 7 additions & 9 deletions assets/js/modules/cart.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/**
* cart
* @author Deux Huit Huit
*/
* cart
* @author Deux Huit Huit
*/
(function ($, undefined) {

'use strict';

var fetchCart = function () {
Expand All @@ -13,7 +12,7 @@
dataType: 'json',
success: function (cart) {
App.notify('cart.update', cart);
}
},
});
};

Expand All @@ -32,13 +31,12 @@
App.register(function () {
return {
app: {
init: init
init: init,
},
cart: {
itemAdded: onItemAdded,
forceUpdate: onForceUpdate
}
forceUpdate: onForceUpdate,
},
};
});

})(jQuery);
Loading