Giter Site home page Giter Site logo

sevenpillarsdesign-webpack's Introduction

๐Ÿ“ฆ Webpack Boilerplate for Shopnex

Minimal Webpack 4 boilerplate for template development for Shopnex. has Babel, Sass, ESLint, Hot Module Replacement, and optimized for development/production.

Installation

git clone https://github.com/rahul-soni11/webpack-boilerplate-django.git
npm i

Usage

Local testing

For testing templates locally you need to have a running copy of the Django project.

In Template repo [Webpack]

  1. Set public_path: 'http://localhost:8080/' in config/paths.js file. So your template can load assets from the localhost.
  2. Start local server npm start, This will generate dist/webpack-stats.json file. Login to superadmin site of your tenant and copy data from webpack-stats.json file to Site Settings > Webpack stats: and Save.

In Shopnex Project [Django]

By default, the Shopnex project will look for the templates in an S3 bucket named as tenant's hostname/template/.

Follow given steps to add the path of template folder in template settings, so if the template not found in the S3 bucket it will load from the specified location.

Note: Make sure there are no templates files in available in S3 bucket named as your tenant's hostname

  1. After cloning this repo, Copy the absolute path of /src/html/ dir. example:

cd sevenpillarsdesign-webpack/src/html

run pwd , this will give you full path like /Users/rahulsoni/React/sevenpillarsdesign-webpack/src/html

  1. Edit TEMPLATES settings in the Django project. Add path in the DIRS list.

for shopnex e-commerce project you need to edit ecommerce/settings/base.py file.

TEMPLATES = [{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [
        os.path.join(BASE_DIR, '../templates/'),
        'PASTE_FULL_PATH_OF_HTML_WHAT_WE_COPIED_IN_STEP_1',
    ],
    'OPTIONS': {
        'context_processors': context_processors,
        'loaders': loaders,
    },
}]

Deploy Bundle

To deploy bundle you need to build and sync dist folder with S3 bucket. S3BUCKETNAME = named as tenants hostname

  1. Set public_path: 'https://s3.ap-south-1.amazonaws.com/<_S3BUCKETNAME_>/'
  2. build the project.
npm run build
  1. cd into dist dir and sync with s3
aws s3 sync . s3://<_YOUR_BUCKET_NAME_>
  1. Make static directory public in S3 bucket.

  2. Login to superadmin site of your tenant and copy data from dist/webpack-stats.json file to Site Settings > Webpack stats: and Save.

Features

Dependencies

Webpack

Babel

Loaders

Plugins

File Structure

File structure reference for Django Shopnex ecommerce project.

html/ โ”œโ”€โ”€ accounts โ”‚ย ย  โ””โ”€โ”€ auth โ”‚ย ย  โ”œโ”€โ”€ _form_errors.html โ”‚ย ย  โ”œโ”€โ”€ account_activation_blank.html โ”‚ย ย  โ”œโ”€โ”€ login.html โ”‚ย ย  โ”œโ”€โ”€ register.html โ”‚ย ย  โ””โ”€โ”€ send_confirm_email.html โ”œโ”€โ”€ base.html โ”œโ”€โ”€ blank-page.html โ”œโ”€โ”€ cart.html โ”œโ”€โ”€ flatpages โ”‚ย ย  โ””โ”€โ”€ default.html โ”œโ”€โ”€ footer.html โ”œโ”€โ”€ navbar โ”‚ย ย  โ”œโ”€โ”€ _auth_cart.html โ”‚ย ย  โ””โ”€โ”€ navbar.html โ”œโ”€โ”€ products โ”‚ย ย  โ”œโ”€โ”€ _items.html โ”‚ย ย  โ”œโ”€โ”€ detail-parts โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ _description.html โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ _images.html โ”‚ย ย  โ”œโ”€โ”€ detail.html โ”‚ย ย  โ”œโ”€โ”€ list.html โ”‚ย ย  โ””โ”€โ”€ pagination.html โ”œโ”€โ”€ registration โ”‚ย ย  โ”œโ”€โ”€ logged_out.html โ”‚ย ย  โ”œโ”€โ”€ password_change_done.html โ”‚ย ย  โ”œโ”€โ”€ password_change_form.html โ”‚ย ย  โ”œโ”€โ”€ password_reset_complete.html โ”‚ย ย  โ”œโ”€โ”€ password_reset_confirm.html โ”‚ย ย  โ”œโ”€โ”€ password_reset_done.html โ”‚ย ย  โ””โ”€โ”€ password_reset_form.html โ””โ”€โ”€ shop โ”œโ”€โ”€ components โ”‚ย ย  โ”œโ”€โ”€ _carousel.html โ”‚ย ย  โ”œโ”€โ”€ _highlights.html โ”‚ย ย  โ”œโ”€โ”€ _instagramSection.html โ”‚ย ย  โ”œโ”€โ”€ _swiper.html โ”‚ย ย  โ””โ”€โ”€ _videoSection.html โ””โ”€โ”€ home.html

Important Shopnex Template Tags

Author

sevenpillarsdesign-webpack's People

Contributors

rahul-soni11 avatar

Watchers

 avatar

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.