GithubHelp home page GithubHelp logo

webpack-remaster's Introduction

creating project from scratch

git clone (link from github ssh) in local

initialize new npm project(create new package.json)

  • npm init

create a src folder

create dist folder. (could be named as public as well)

{{ ~~ create 2 folders (js & scss) in src {{ ~~ create js folder in public}}
make 2 files in src and dist (main,js & main.scss) make an index.js file in src folder ~~ }}


install webpack 4

npm install webpack npm install webpack-cli

add dev and production webpack scripts to your package -- go to package.json and paste this script instead of the one exist => "scripts": { "dev": "webpack --mode development ./src/js/main.js --output ./dist/js/main.js", "production": "webpack --mode production ./src/js/main.js --output ./dist/js/main.js" }, build scripts in development mode

npm run dev s

  • go to main.js src and paste import '../scss/main.scss';

create webpack.config.js

go to webpack.config.js => delete everything before & paste this:

var ExtractTextPlugin = require('extract-text-webpack-plugin');

module.exports = { module: { rules: [ { // css / sass / scss loader for webpack test: /.scss$/, use: ExtractTextPlugin.extract({ use: ['css-loader', 'sass-loader' ], }) } ] }, plugins: [ new ExtractTextPlugin({ // define where to save the file filename: '../css/style.css', allChunks: true, }), ], };

  • paste this in terminal: npm install extract-text-webpack-plugin@next

add a watcher to watch your changes by pasting this: "watch": "npm run dev -- --watch",

in package.json in the scripts section

npm run watch to run the command


webpack-remaster's People

Contributors

fahd-93 avatar

Watchers

James Cloos 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.