Git Product home page Git Product logo

slate's Introduction

Build Status npm version

This repo is archived in favor of the Shopify developer tools announced in Unite 2021.

Dawn is Shopify's reference theme.

============================================

slate animated banner

⚠ Slate - End of Support (January 2020)

After re-evaluating Slate and its current state, Shopify has decided to officially end support for Slate.

Why?

With the launch of our new section theme architecture we're taking a step back to examine our current tooling and how we can deliver the best theming experience to our theme developers.

Slate is not in line with our vision for themes moving forward and it does not solve two of the larger asks our theme developers have made:

  • Local development of a Shopify theme
  • Support for code versioning within themes

I’m a theme developer that is using Slate. What should I do now?

Slate was built upon Theme Kit as an opinionated way to setup up a Shopify theme build. Shopify will continue to actively maintain and support the growth of Theme Kit through the open-source community.

You can continue using Slate the way you have been. While we will not be maintaining it any longer, you can still fork the repo to suit your own needs.


Slate v1.0 is currently in beta. Expect more bugs than a final release. If you are migrating from using the previous version of Slate, please review the new documentation as there are breaking changes. Slate v1.0 has not yet been tested on Windows.

To view the previous version of Slate, visit the 0.x branch.

Slate empowers developers of all skill levels to build quality Shopify themes. Slate guides developers by providing a tested workflow and opinionated development toolkit, while also accommodating more established developers through advanced configuration.

🚀 Get started with a new Slate project

Documentation

Visit the official Slate documentation website for complete documentation Slate's concepts and technical details, as well as helpful guides!

Contributing

For help on setting up the repo locally, building, testing, and contributing please see CONTRIBUTING.md.

Code of Conduct

All developers who wish to contribute through code or issues, take a look at the Code of Conduct.

License

Copyright (c) 2018 Shopify. See LICENSE for further details.

Thanks

We would like to specifically thank the following projects, for the inspiration and help in regards to the creation of Slate:

slate's People

Contributors

andyexeter avatar bertiful avatar bpscott avatar carolineschnapp avatar cshold avatar davidcornu avatar driespieters avatar gabrielajungblut avatar gmalette avatar jonathanmoore avatar jore avatar jtgrenz avatar kazazes avatar luangjokaj avatar m-ux avatar maximevaillancourt avatar mmorissette avatar mpiotrowicz avatar nathanpjf avatar rickitan avatar saudslm avatar shopify-admins avatar stevebosworth avatar stevekanter avatar t-kelly avatar tiffanytse avatar tmlayton avatar tshamz avatar tvanc avatar wizardlyhel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slate's Issues

Using sass underscore

I cannot link my theme.scss to partials sass files like _mixings.scss I receive this terminal message "Cannot find file 'settings/deprecation-warnings'".

There is a way to import files with sass underscore?

Missing Snippet

Upon installing a fresh copy of the theme there is a snippet error:

Liquid error (line 39): Could not find asset snippets/icon-cart.liquid Cart (0 items)

This snippet does not exist in the snippets folder.

Sections and .scss

Hi,
is it possible to access section settings from .scss files ? Basicaly, I want to be able to set css value from the Section editor and use them in the corresponding scss 'modules'.
If I rename site-header.scss to site-header.scss.liquid it can access settings.bg_color but not section.settings.bg_color. hope that make sense !

Feedback email address doesn't work

Problem

The feedback email ([email protected]) in the sidebar source is broken / not open to the public. I sent some feedback in but got the following response:

Hello [email],

We're writing to let you know that the group you tried to contact (slate) may not exist, or you may not have permission to post messages to the group. A few more details on why you weren't able to post:

  • You might have spelled or formatted the group name incorrectly.
  • The owner of the group may have removed this group.
  • You may need to join the group before receiving permission to post.
  • This group may not be open to posting.

If you have questions related to this or any other Google Group, visit the Help Center at https://support.google.com/a/shopify.com/bin/topic.py?topic=25838.

Thanks,

shopify.com admins

Scope

Is this an issue with Slate's theme scaffolding or its documentation?

If it is related to the slate commands, perhaps the slate-cli repo or the slate-tools repos are a more appropriate spot to log your issue.

Documentation.

Replication steps

How to replicate the problem. Screenshots or video?

image

Click Provide feedback link. Send an email (that's not from the shopify.com domain).

More Information

Any additional information which might be helpful.

[Docs] Update demo SCSS imports to absolute URLs

See comments in #59. When the repo is live, we should remove the docs/_sass/slate directory and change the @import statements in docs/css/demos.scss to absolute URLs pointing at the master Slate branch. Remove the comment explaining it as well.

flush CDN cache on deploy

Problem

When deploying /latest with Shipit, there's no way for the CDN to know these are new files because the file name for the zip is the same causing changes to take up to 24 hours.

Solution: Add a command to shipit.yml to flush the cache on deploy.
https://github.com/Shopify/slate/blob/master/shipit.yml

More information

To flush the cache on deploy takes a certain credential that I will have to ask Edgescale about.

How to import css file

I am trying to import semantic.css (Semantic-ui) file from styles/vendor folder in theme.scss file but I am getting error in browser console file not theme.scss.css file not found

Migrate includes config.yml

Problem

I just ran slate migrate on an existing theme and the config.yml file was not generated.

Did I miss something or am I supposed to create that file manually?

Updating slate version and ignoring locales

Great package...

  1. I have a theme I am developing and is deployed to live sites. How do I update slate (from version 0.9.1) to the latest version for this theme to take advantage of improvements?

  2. I know I can ignore files during deployment using config.yml, but what is the best practice for ignoring locale files? If I simply ignore /locales/en.default.json from live sites, then they will not benefit from new terms that are added throughout the life of a project.

Appreciate your guidance.

Cheers.

product view and JS require an image

Issue

The markup and JS assumes your product images will always have an image.

  • When product template doesn't have a featured image, it renders the placeholder tag.
  • The JS throws an error when it goes looking for an image selector and doesn't find one.

I realize it's not common for a product not to have an image, but it's an assumption baked into the theme that should be addressed.

Reproduction

Make a product that has no images associated with it. Example screenshot: http://take.ms/zIVff

Screenshot of feature product section

http://take.ms/P5jDA

Problem code

Three areas:

  • featured-product.liquid
  • product.liquid
  • product.js

In featured-product.liquid, it assumes that if you don't have a featured image then you must be onboarding:

  {% if product.featured_image.src != blank %}
    {{ product.featured_image.src | img_url: '480x480' | img_tag: product.featured_image.src.alt, 'product-image' }}
  {% else %}
    {{ 'product-1' | placeholder_svg_tag: 'placeholder-svg placeholder-svg--small' }}
  {% endif %}

In product.liquid there's no check if a featured image exists.

In product.js there is no check whether $(selectors.productFeaturedImage, this.$container) yields any results first.

this.settings.imageSize = slate.Image.imageSize($(selectors.productFeaturedImage, this.$container).attr('src'))

deployment based on ip address?

So deployment from 'slate watch' has been working fine from work however when I ran 'slate watch' today in a coffee shop, the changes would be picked up but deployment would be stuck at 0%. I waited like 5 minutes to make sure it wasn't the internet (it was only a 759kb file too).

I'm not familiar with how deployment works but are there any IP address checks or something?

JS Error: Cannot read property 'extend' of undefined

Problem

On Slate, I'm getting a console error stating: Uncaught TypeError: Cannot read property 'extend' of undefined in theme.js.

The problematic line is: slate.Sections.prototype = $.extend({}, slate.Sections.prototype, { on line number: 262.

I'm struggling to figure out whether it's one of my files that's the problem or one of Slate's.

I've not modified theme.js or any of it's JS includes.

If anywhere, it's coming from my custom.js, so maybe there's a conflict of some sort?

Starting a new theme without one in your theme store already

Issue

Creating a new Slate theme requires a config.yml file where you have defined theme ID already. This means that you need to duplicate/choose a theme online to get the ID. When you run your first deploy, it takes longer than you'd like because we need to do a replace on every file.

Possible solution

ThemeKit has a theme bootstrap command that will create a new theme in your store for you: http://shopify.github.io/themekit/#use-a-new-theme This use the latest release of Timber by default.

Could we have a similar command for Slate that would create your theme using the lastest build? Example:

slate bootstrap —password=[your-password] --store=[your-store.myshopify.com]

Other info

It's likely we will sunset Timber, so the existing theme bootstrap command would then need to either go away or change to pull Slate instead (which would solve this).

/cc @tanema re: Timber sunset

No build tools flow

In the getting started section there’s a quote that says:

Node 4+ is supported, but 6+ is recommended to fully benefit from Slate. If you want the template files without the build tools, get the latest zip here.

Issue

This download gives you the src files; not a distribution folder. So you would still need the build tools installed to use it.

  1. This is confusing - do I need the build tools or not?
  2. Should the link be to an already compiled theme? i.e. The dist version?

Suggestion

  • Re-write this section as two separate thoughts.
  • Clarify what the zip you're downloading is for (two options below)

Getting started

Node 4+ is supported, but 6+ is recommended to fully benefit from Slate.

The steps below walk through installing Slate globally and configuring your development theme to sync with your store. You can [download a zip here](link to src files) of just the theme files, however you will require Slate's build tools to compile theme into a working theme.

-- or --

The steps below walk through installing Slate globally and configuring your development theme to sync with your store. If you want the theme files without the build tools dependency, [get the latest zip here](link to dist files).

Question: Sourcemap support

Not so much an issue as a feature question. I'm relatively new to Gulp so having a bit of trouble finding the answer to this...

Is there a way to enable sourcemaps? Would be really useful for devtools/workspace workflow.

Thanks!

Ajax functions for cart.js

Problem

The Slate project does not have helper scripts for ajax carts. We have an opportunity to simplify the methods described in our Ajax API documentation for themes.

Related issue: #132

Scope

The helper script to add his to that would make most sense is cart.js. From the conversation by @t-kelly in the related issue above;

We are currently working on expanding cart.js so that it has more helpful functions like cart.addItem(), cart.changeItem(), etc. The functions included in this file should make creating an AJAX cart a lot easier, while not being opinionated on how the Liquid and CSS is written. Hoping to have a PR open in the near future.

The methods that we shipped in Narrative would be useful.

More Information

Other helpers for Shopify: Cart JS

The core API of CartJS is worth taking a look at for additional inspiration.

The data API also included is very cool, but likely out of scope of what we'd like to ship as a helper script. Reason: using certain methods makes assumptions about your page markup. For example, data API's adding items adds based on a variant ID.

<button data-cart-add="12345678">Add a Widget</button>

This works great, assuming this is the only information you need. But if you want to also handle line item properties in the future, you won't want to use this method.

Side note: You could accomplish the same thing as the above example with:

<a href="https://mystore.com/cart/add?id=12345678&quantity=1">Add a Widget</a>

Status: 422 Unprocessable Entity, Errors: Theme files may not be stored in subfolders

Status: 422 Unprocessable Entity

Errors: Theme files may not be stored in subfolders

When using command slate deploy -e development

slate will look at config/theme/dist/folder/file
but I don't have a parent folder above my theme name 'config'.

How can I make slate look in my /dist while deploying?

screen shot 2017-05-10 at 10 04 49 pm

development:
password: ---
theme_id: "174469070"
store: shop.myshopify.com
ignore_files:

production:
password: ---
theme_id: "132337347"
store: shop.myshopify.com
timeout: 1m0s
ignore_files:

Using IncludeMedia.scss as an include breaks Slate's Compiler.

Problem

There's something about using Eduardo Bouças' Include Media.scss that breaks the compiler.

If I create a new *.scss file and place it in either Global or Tools, I insert normal CSS to test:

* { color: red; }

And include the new file in theme.scss via @import url('global/includemedia.scss');, it works fine, as expected.

But when I paste in the IncludeMedia's SCSS code, Shopify shows the error: Failed to compile SCSS file

I've used this file in previous SCSS projects that weren't using Slate, so it can't be a problem with the document itself.

Scope

Problem seems to occur with the theme scaffolding

Replication steps

  1. Download IncludeMedia.scss
  2. Create a new SCSS document in any of the styles folders (And @import) and set up slate watch
  3. Paste in IncludeMedia and wait for the store to reload.

Remember the minimization state for theme preview notification

Problem

When watching a slate theme (slate watch), in the localhost/external URL provided by browsersync, we consistently get a slide up notifying You are currently previewing the theme: theme_name. Even with each reload, the bottom bar pops up each time. Once minimized, this choice should be remembered locally as a user-defined choice.

Scope

This is an issue with the theme scaffolding.

Replication steps

  • Deploy a theme successfully.
  • Fire slate watch.
  • The browersync link opens successfully with a bottom bar notifying that it's a theme preview.
  • Click 'Minimize'.
  • Make some changes to any file in the theme.
  • The bottom bar pops back again.

Document supported Sass version

Problem

It is not well-documented what version of Sass the online editor supports. As a results, developers are not sure why their Sass isn't compiling (example: #117).

Possible places this can be documented:

  • Write a note in the Slate docs about the supported Sass version.
  • Public documentations site under "Building Themes"

Perhaps we can have a linter or some plugin that can help detect if files that are *.scss (no Liquid) are using methods that don't work in the supported version and then throw an error.

Switch to data-attribute selectors for product.js

Proposal

Don't use classes as selectors in product.js, but data attributes instead.

Alternatively, prefix these selectors with js-* as they are being used by a script and not a stylesheet.

Why

  • Ship Slate with no generic prescribe classes in product.liquid that will likely conflict with vendor CSS.
  • If we were to ship classes, I'd rather we encourage BEM syntax (or an equivalent). Otherwise, I am going to be re-writing this class selectors every project I start.
    • Alternatively, a js-* prefix would also address the need to rewrite these selectors.

Looking to discuss with @Shopify/themes-fed

Background

I'm porting an existing commerce theme to use Slate. While setting up the product.liquid section file, I noticed that the markup isn't using BEM. Example:

<div class="price-wrapper">
  <span class="product-price">{{ current_variant.price | money }}</span>
</div>

...

<button type="submit" name="add" class="add-to-cart">
  <span class="add-to-cart-text">{{ 'products.product.add_to_cart' | t }}</span>
</button>

A number of generic classes were already in use by my theme on different elements, so I had to change what Slate shipped. As a by-product, I also had to make modifications in the product.js file's selectors object:

  var selectors = {
    addToCart: '.add-to-cart',
    addToCartText: '.add-to-cart-text',
    // etc.
  };

All of which raised the question: Do we need to use class selectors in our JS?

Proposal

I'm proposing we use data-attributes to tell our scripts what different components actually are, without necessarily giving the data attribute a value. Example:

<span data-product-price>
  {{ current_variant.price | money }}
</span>

W3C references

I know that there are opinions that data attributes should be used only when you have actual information you want to store. Example: Setting the slide speed with data-slide-speed="500". Everywhere I've looked, those that feel you shouldn't use a data-attribute with no value reference the W3C spec:

Custom data attributes are intended to store custom data private to the page or application, for which there are no more appropriate attributes or elements

Source: http://w3c.github.io/html/dom.html#embedding-custom-non-visible-data-with-the-data-attributes

But W3C... I feel a class isn't an appropriate selector. Coupling JS behaviour to classes and page style is a risk I don't feel is appropriate. ... Now what, W3C?

Comparison framework: Foundation

I took a look at what the Foundation framework is doing, and they use an implementation that seems to line up with my proposal.

Classes are used to manipulate styles. As much as possible, Foundation avoids using classes to indicate things to JavaScript, and also avoids directly applying CSS attributes with JavaScript, preferring to add modifier classes as needed.

Data attributes are used for communicating with the Foundation JavaScript. These are what tell Foundation what type of component something is, and what types of options to configure it with.

Source: Control Your Behavior with Foundation’s Data Attributes

In the example from that blog, Foundation will use a standalone data-attribute like data-slider-handle in order to tell the JS where the handle is and let class take care of styling.

<div id="example-slider" class="slider" data-slider data-initial-start="50" data-end="200">
  <span class="slider-handle"  data-slider-handle role="slider" tabindex="1"></span>
  <span class="slider-fill" data-slider-fill></span>
  <input type="hidden">
</div>

Implementation for foundation.slider.js in their repo: https://github.com/zurb/foundation-sites/blob/develop/js/foundation.slider.js#L55

Quick note: Bootstrap

I looked into Bootstrap, and they appear to opt for classes and only use data-attributes in their selectors when they need their values. Example: carousel.js selectors. However, I feel Bootstrap's framework is too opinionated to be compared to what we are trying to do with Slate.

Selector speed and alternative opinions

I am aware that selector speed is brought up a lot in favour of classes. That using classes to read through the whole DOM is faster than data-attributes. For that, I suggest reading this article: Don’t use data attributes to find HTML elements with JS.

The author brings up this speed argument, but more importantly for this issue the author would state what we are doing with our current classes isn't a good idea. The takeaway being that you should prefix your selectors with js-*. ... Which I can get on board with if we were to ignore the wisdom of Foundation.

More performance stuff: From reading around the 'net, the data-attribute selector speed is often quoted as only being a problem in very large applications with nodes in the thousands. And in the comments of that blog post, a commenter (Chris Rivera) says all of the speed concerns can be side-stepped by properly caching your selector and scoping future look ups. i.e.

var $module = $([data-module=Cars]);
var $list = $module.find([data-cars]);

^ This is effectively what Foundation is doing.

Ship with .gitignore

Problem

When creating a new theme or migrating an exsisting, there is no .gitignore so both node_modules and dist get commited to the git repo. Would be a nice to ship with this configured!

Cart Item Quantity Translation Missing

Problem

When using the Slate Cart template, there is a Shopify error message caused by a missing translation.

Using {{ 'cart.general.item_quantity' | t }} found within the Quantity Input element produces this error message:

translation missing: en.cart.general.item_quantity

slate translation missing

Scope

Theme Scaffolding

Replication steps

Load the default Slate cart template in your browser with at least one item in your cart, and using Inspector tools, view the Quantity element for an item, you'll see the aria-label contains this issue.

variant selection when option values are not unique

Issue

When the potential values for product.option can be the same between different product options, the _getVariantFromOptions cannot select the appropriate variant.

In this video, you can see the issue: https://screenshot.click/screencast_2017-02-20_00-01-39.mp4

  • I create a product with two variants called "Bay Rans"
  • On the "Bay Rans" product page, the variant information never changes because the script always thinks the selected variant is 36999176335. Even when the combination doesn't create a valid variant.
  • I then show that the script is working properly on a product page with 3 options.

Reproduction

Create a product with the following variant titles:

Variant 1: Red / Black
Variant 2: Black / Red

Pings

@Shopify/sustaining-themes @Shopify/themes-fed This issue sounds familiar to me. Has this been addressed in a past issue for Debut?

Log SCSS errors into console

Would be awesome if Slate would log SCSS errors like gulp-scss. Otherwise linting is the last line of defense before it makes it to the Shopify servers.

Browsersync breaks on custom domain with password enabled

When running slate start or slate watch on a Shopify store that has a custom domain with force redirect and password protection enabled, the browser will be redirect out of the localhost proxy and therefore breaking Browsersync.

Reproduce

  • Navigate to Shopify store with custom domain enabled
  • Make sure all traffic is being forced to the custom domain
  • Password protect the store
  • Run slate start or slate watch to the given store
  • You should be redirected out of the localhost proxy and to the custom domain /password

Video: https://screenshot.click/23-59-xrh6y-33nuk.mp4

Preview Password Protected Site Locally

Problem

I have a development store that is password protected. Running slate start shows the password page at localhost:3000.

Scope

Normally, if I am logged into admin, I do not see the password page on a password protected site.

Replication steps

Password protect a site, run slate start.

Slate cannot compile Bootstrap 4

Problem

I have tried to get Bootstrap 4 Alpha 6 SCSS to work with slate, however, when I try typing 'slate start' in the terminal, the files are successfully synced to the Shopify store. But in the inspect console, the file says 'can not get' and if you open the file in a new tab it says: 'Failed to compile SCSS file'.

Does this have anything to do with the version of Sass Slate uses (A fork of 3.2)?

Sass Version 3.3

In Sass version 3.3 they introduced Sass script maps which seems to be one thing that breaks the compilation of Bootstrap:
http://sass-lang.com/documentation/file.SASS_CHANGELOG.html#selector_functions

Liquid settings / values Global JS object

Can we make our liquid settings object (ie... currently window.theme.strings namespace) more robust to include any setting someone would potentially need access to in JS from a single discreet location, that's always available on every page?

This prevents developers from needing to inline liquid in their JS files, and from needing to store things in data attributes on DOM objects all the time (which only make sense in certain situations).

accessible payment icons

Issue

Our payment icons are unreachable by screen readers.

Reason

These SVGs have the attribute aria-hidden="true". Screenshot here

In the utility tasks, we are wrapping all icons in aria-hidden="true" focusable="false" role="presentation". Source:
https://github.com/Shopify/slate-tools/blob/937bc5b76a12eaae29bbedc47ce4a6f86bc48b70/src/tasks/includes/utilities.js#L67

Solutions

Accessible SVG

For the SVG to be discoverable by screen readers, it would need to have role="img" and either a title attribute on the svg or a <title> element within the svg. The aria-hidden would need to be removed as well. Screenshot

This would also require changing our build tasks to be able to set the role on an icon by icon basis. This makes it a bit more complicated.

Fallback text

Have "fallback text" with the class of visually-hidden. Screenshot This would be simpler and we can include the HTML/Liquid in the footer section.

Plans for ajax cart?

Are there any plans on adding an ajax cart option as part of slate? specifically with ajax cart drawer functionality.

I'm in the middle of developing a theme right now with slate and porting over the ajax cart code from https://shopify.github.io/Timber/ .

Since timber is no longer being maintained, will my theme's ajax cart functionality possibly experience issues in the future?

Watchify needs to build to bind update event

Not that this is a big one but when running slate start or slate watch, the js build task runs on watch init rather than running on file change. This is due to the way that watchify works but it would be nice to fix this.

[Docs] config-sample.yml

The config-sample.yml file downloaded from the public docs is out of date and doesn't reflect the sample in this repo.

Reproduction steps

Public docs

Running slate theme

  • Run slate theme <name>
  • Open config-sample.yml

Solution

The latest release just needs to be updated, I believe. Putting this issue here as a reminder to fix this before any public release.

clean up SVGs in src

Our SVG icons has a real assortment of markup. Sketch, IcoMoon, Adobe Illustrator. Example:

<title>Shape</title>
<desc>Created with Sketch.</desc>

We already have a gulp task that cleans this stuff up for dist, but I'm making a note to myself to clean up the src file a bit because it's irkin' me.

Compare at price display

product.liquid has the following conditional for displaying the compare at price:

{% if current_variant.compare_at_price_max > current_variant.price %}

Line:

{% if current_variant.compare_at_price_max > current_variant.price %}

.compare_at_price_max is not a property of the variant object. It should be : current_variant.compare_at_price

{% if current_variant.compare_at_price > current_variant.price %}

Currency formatting without decimals

Problem

Using slate.Currency's formatMoney method incorrectly returns cents and decimal places if you use the amount_no_decimals or amount_no_decimals_with_comma_separator format.

Scope

This is an issue with Slate's JavaScript functionality in the theme scaffolding - /src/scripts/slate/currency.js

Replication steps

If the amount_no_decimals or amount_no_decimals_with_comma_separator case is used formatWithDelimiters(cents, 0); or formatWithDelimiters(cents, 0, '.', ','); is called.

In the formatWithDelimiters method, the precision variable is set to 2 as a default if the variable does not exist.

precision = precision || 2;

However, since the precision argument in the formatWithDelimiters method could be 0, the line above is seeing precision == false == 0 it is incorrectly setting the value to 2.

More Information

The previous version of this file carolineschnapp/currencies/master/jquery.currencies.js used a more explicit way to handle default values.

function defaultOption(opt, def) {
  return (typeof opt == 'undefined' ? def : opt);
}

precision = defaultOption(precision, 2);

With this explicit approach, the value of precision could be correctly set to 0.

dev environment points to live

From conversation in Shopify/slate-tools#39

We are having the development environment point to the live theme by default. The is where a production environment should point. We should encourage pushing to a safe dev environment by default.

[Docs] Explain custom events in variant.js

Current docs for Product variants focuses on the examples in product.js. These functions are based off of custom events in variant.js that are not explained in the docs.

Going to add a blurb explaining those and that you can use those to build your own callbacks.

Documentation is not available .

  1. Documentation is not available for this framework.
    Where is Documentation for this framework?

  2. Are there any facility like Timber frame work to develop theme ? for - ajax-cart,Drawer etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.