├── src ├── app.js ├── components │ ├── button │ │ ├── button.pug │ │ └── button.css │ └── plan │ │ ├── plan.pug │ │ └── plan.css ├── main.css └── index.pug ├── .DS_Store ├── README.md ├── .gitignore ├── package.json ├── webpack.config.js └── dist ├── index.html ├── main.css └── main.bundle.js /src/app.js: -------------------------------------------------------------------------------- 1 | import './main.css' -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krashaen/pugWithWebpack/HEAD/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pugWithWebpack 2 | ## перед запуском нужно выполнить 3 | 1) `npm install` 4 | 2) `npm run dev` 5 | готовые файлы появятся в папке `dist` 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | coverage/ 3 | .history/ 4 | .idea/ 5 | .vscode/ 6 | .project/ 7 | build/ 8 | npm-debug.log 9 | src/assets/index.html 10 | gemini/gemini-reports 11 | gemini/screens 12 | dist/ -------------------------------------------------------------------------------- /src/components/button/button.pug: -------------------------------------------------------------------------------- 1 | mixin btn(options) 2 | - 3 | var buttonClassName = "button" 4 | buttonClassName += options.isBlue ? " button-blue" : "" 5 | button(class = buttonClassName)= options.title || "Button" -------------------------------------------------------------------------------- /src/main.css: -------------------------------------------------------------------------------- 1 | @import "components/button/button.css"; 2 | @import "components/plan/plan.css"; 3 | 4 | body { 5 | font-family: 'Source Sans Pro', Arial, sans-serif; 6 | font-size: 18px; 7 | line-height: 1.45; 8 | color: #999; 9 | -webkit-font-smoothing: antialiased; 10 | } 11 | 12 | .wrapper { 13 | display: flex; 14 | justify-content: space-around; 15 | flex-wrap: wrap; 16 | } 17 | -------------------------------------------------------------------------------- /src/components/button/button.css: -------------------------------------------------------------------------------- 1 | .button { 2 | outline: none; 3 | border: 1px solid #e0e0e0; 4 | color: #008ed6; 5 | padding: 14px 40px; 6 | border-radius: 3px; 7 | font-size: 14px; 8 | font-weight: bold; 9 | text-transform: uppercase; 10 | cursor: pointer; 11 | } 12 | .button:hover { 13 | background: #008ed6; 14 | border: 1px solid #008ed6; 15 | color: #fff; 16 | } 17 | .button-blue { 18 | color: #fff; 19 | background-color: #008ed6; 20 | } 21 | -------------------------------------------------------------------------------- /src/index.pug: -------------------------------------------------------------------------------- 1 | include ./components/plan/plan 2 | 3 | doctype html 4 | html(lang="en") 5 | head 6 | meta(charset="UTF-8") 7 | title Пример страницы 8 | link(rel="stylesheet" type="text/css" href="main.css") 9 | 10 | body 11 | .wrapper 12 | +plan({title: "free", price: 0}) 13 | +plan({title: "personal", price: 25}) 14 | +plan({title: "business", price: 50, isBusiness: true}) 15 | +plan({title: "ultimate", price: 99}) 16 | 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "component", 3 | "version": "0.0.1", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "build": "webpack --mode=production", 8 | "build:dev": "webpack --mode=development", 9 | "start:dev": "webpack-dev-server --mode=development", 10 | "dev": "webpack --watch --mode development", 11 | "prod": "webpack --mode production" 12 | }, 13 | "author": "mikhail krasheninnikov", 14 | "devDependencies": { 15 | "html-webpack-plugin": "^3.2.0", 16 | "pug": "^2.0.3", 17 | "pug-loader": "^2.4.0", 18 | "webpack": "^4.29.5", 19 | "webpack-cli": "^3.2.3", 20 | "webpack-dev-server": "^3.2.1" 21 | }, 22 | "dependencies": { 23 | "css-loader": "^2.1.0", 24 | "extract-text-webpack-plugin": "^4.0.0-beta.0", 25 | "html-loader": "^0.5.5", 26 | "pug-html-loader": "^1.1.5", 27 | "style-loader": "^0.23.1" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/components/plan/plan.pug: -------------------------------------------------------------------------------- 1 | include ../button/button 2 | 3 | mixin plan(options) 4 | - 5 | var priceClassName = "price" 6 | priceClassName += options.isBusiness ? " price-business" : "" 7 | var titleClassName = "title" 8 | titleClassName += options.isBusiness ? " title-business" : "" 9 | var countClassName = "price-count" 10 | countClassName += options.isBusiness ? " price-count-business" : "" 11 | .plan 12 | div(class = titleClassName)= options.title 13 | div(class = priceClassName) 14 | span(class = countClassName) 15 | em $ 16 | span= options.price 17 | small.period /per month 18 | .description 19 | p 20 | | Fusce fermentum placerat magna ac pharetra. 21 | | Aliquam euismod elit non ipsum 22 | a.description-link(href="#")= "lacinia " 23 | | consectetur. 24 | 25 | .buy-button 26 | +btn({title: "Order Now", isBlue: options.isBusiness}) 27 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const ExtractTextPlugin = require('extract-text-webpack-plugin'); 3 | const HtmlWebpackPlugin = require('html-webpack-plugin'); 4 | const pug = { 5 | test: /\.pug$/, 6 | use: ['html-loader?attrs=false', 'pug-html-loader'] 7 | }; 8 | const config = { 9 | entry: './src/app.js', 10 | output: { 11 | path: path.resolve(__dirname, 'dist'), 12 | filename: '[name].bundle.js' 13 | }, 14 | module: { 15 | rules: [ 16 | pug, 17 | { 18 | test: /\.css$/, 19 | use: ExtractTextPlugin.extract( 20 | { 21 | fallback: 'style-loader', 22 | use: ['css-loader'] 23 | }) 24 | }, 25 | ], 26 | }, 27 | 28 | plugins: [ 29 | new ExtractTextPlugin( 30 | { 31 | filename: 'main.css', 32 | } 33 | ), 34 | new HtmlWebpackPlugin({ 35 | filename: 'index.html', 36 | template: 'src/index.pug', 37 | inject: false 38 | }), 39 | 40 | ] 41 | }; 42 | module.exports = config; -------------------------------------------------------------------------------- /src/components/plan/plan.css: -------------------------------------------------------------------------------- 1 | .plan { 2 | border: 1px solid #e0e0e0; 3 | flex-basis: 270px; 4 | margin: 10px; 5 | } 6 | .title { 7 | display: flex; 8 | align-items: center; 9 | justify-content: center; 10 | height: 70px; 11 | border-bottom: 1px solid #e0e0e0; 12 | font-size: 24px; 13 | text-transform: uppercase; 14 | font-weight: 700; 15 | color: #1a1a1a; 16 | } 17 | .title-business { 18 | color: #008ed6; 19 | } 20 | .price { 21 | padding: 32px 0 35px; 22 | text-align: center; 23 | border-bottom: 1px solid #e0e0e0; 24 | } 25 | .price-business { 26 | background-color: #008ed6; 27 | color: #fafafa; 28 | } 29 | .price-count { 30 | color: #1a1a1a; 31 | font-size: 60px; 32 | font-weight: 600; 33 | line-height: 1; 34 | } 35 | .price-count-business { 36 | color: #fafafa; 37 | } 38 | .price-count em { 39 | vertical-align: super; 40 | font-size: 28px; 41 | font-style: normal; 42 | } 43 | .period { 44 | line-height: 1; 45 | display: block; 46 | width: 100%; 47 | font-size: 18px; 48 | margin-top: 5px; 49 | } 50 | .description { 51 | padding: 45px 20px 29px; 52 | text-align: center; 53 | } 54 | .description-link { 55 | text-decoration: none; 56 | color: #337ab7; 57 | } -------------------------------------------------------------------------------- /dist/index.html: -------------------------------------------------------------------------------- 1 |
Fusce fermentum placerat magna ac pharetra. 2 | Aliquam euismod elit non ipsum lacinia consectetur.
Fusce fermentum placerat magna ac pharetra. 3 | Aliquam euismod elit non ipsum lacinia consectetur.
Fusce fermentum placerat magna ac pharetra. 4 | Aliquam euismod elit non ipsum lacinia consectetur.
Fusce fermentum placerat magna ac pharetra. 5 | Aliquam euismod elit non ipsum lacinia consectetur.