未加星标

Building the Future of Squarespace Templates

字体大小 | |
[前端(javascript) 所属分类 前端(javascript) | 发布者 店小二04 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

Squarespace Templates are powerful tools used by millions of people every day to build their websites without writing code. Since the launch of ourDeveloper Platform, we’ve allowed customers to enter “Developer Mode” on Squarespace Templates, giving them the ability to access and change the files that constitute the template.

Today, we’re excited to announce that we’ve released two of our newest consumer templates― Endeavor and Wright ―on GitHub.

Endeavor and Wright represent the next generation of Squarespace template development, and they look very different from older Squarespace templates. This is because we’ve added a build step to our dev process, enabling us to modernize our templates by writing ES6, use third-party libraries like Lodash, and split out shared code into our own template modules. We’d like to share some of the thinking that went into these changes, as well as the implications for users of the Developer Platform.

A Brief History Lesson

In the past, a Squarespace Template developer would work from a singular design and write all of the markup, styles, and scripts specific to that design. These files would then be pushed to a Git repo on our server, which would handle templating, LESS compilation, and minifying/concatenating scripts.

Although our old process had certain benefits like simplicity, ease of use, and the ability to start with a clean slate for each template build, we also discovered some limitations:

Using modern technologies like ES6 was impossible without a way to transpile to vanilla ES5.

Because we didn’t use a script bundler, we couldn’t use third-party libraries like Lodash, and had to write all of our own utils.

We increasingly ran into situations where we wanted to build the same features in different templates, but we had no way to distribute and maintain code across multiple codebases.

We decided that we needed to update our process and tooling to reflect the increasingly diverse and intensive needs of our own template developers, and to keep up with the changing landscape of web development in general.

The New Process

Our new process has incorporated a number of tools, some of which may be familiar to experienced web developers, and some of which we built to be used specifically with Squarespace.

We use NPM to handle dependency management, and NPM scripts to handle the build itself rather than a task runner like Gulp or Grunt. We had a veritable cornucopia of script bundlers to choose from, but we settled on Webpack due to its versatility and widespread use.

For some of the other things we wanted to accomplish, like packaging non-javascript assets (JSON-Template files, JSON configuration, styles, external SVG resources, etc.) and easily deploying your site, we weren’t satisfied with any existing options, so we decided to build our own tool― Squarespace Toolbelt .

Here’s an example of how your template may look before and after the build:

Before blocks/ navigation.block collections/ blog.list blog.item blog.conf scripts/ site.js blog.js styles/ site.less blog.less site.region template.conf package.json webpack.config.js After blocks/ navigation.block collections/ blog.list blog.item blog.conf scripts/ site-bundle.js styles/ site.less blog.less site.region template.conf

You may notice that the build result looks pretty much like a current Squarespace Template. This is intentional―for our new workflow, we avoided changing the way our server parses template files, so that existing developers and consumers on our platform wouldn’t be affected.

Why and How to Use It

Even if your process bears little resemblance to Squarespace Template Development, our build can still work for you. If you want to use SASS instead of LESS, you can add a compilation step during your build―our server can handle vanilla CSS. If you want to use Browserify or Rollup instead of Webpack, you can easily install those and run them in your own NPM scripts. You can even avoid NPM scripts entirely and use Grunt or Gulp instead. As long as your build result follows the structure of a Squarespace template, you can take any steps you’d like to get there.

We’ve built a number of template modules and have been using them in our newer templates. Available under the @squarespace scope on NPM, these modules include a Javascript API for Squarespace proprietary functionality , a plug-and-play Ajax loader for your website , social icons , layout scripts , and more. Check out the full listhere.

We encourage you to use these modules in your own projects! You can also install Toolbelt in your existing project with npm install @squarespace/toolbelt , clone Endeavor or Wright on GitHub, or start with a blank slate by cloning our base template .

If you’re interested in these types of challenges and would like to join our team,we’re hiring.

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

主题: GitGruntGulpGitHubJavaAjaxJavaScriptCSSSAS
分页:12
转载请注明
本文标题:Building the Future of Squarespace Templates
本站链接:http://www.codesec.net/view/534510.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 前端(javascript) | 评论(0) | 阅读(31)