Skip to content

Commit

Permalink
Babel config minor updates, change fonts loading, rename styles folde…
Browse files Browse the repository at this point in the history
…r `partials` to `components`.
  • Loading branch information
yurayarosh committed May 18, 2021
1 parent b7b3812 commit 8472d4f
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 29 deletions.
21 changes: 12 additions & 9 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,24 @@ module.exports = class extends Generator {
yarn: true,
})
} else {
this.log(`Run ${chalk.blue('npm install')} or ${chalk.blue('yarn')} to install dependencies later.`)
this.log(
`Run ${chalk.blue('npm install')} or ${chalk.blue('yarn')} to install dependencies later.`
)
}
}

end() {
if (this.props.sprites.indexOf('sprite-svg') > -1) {
this.log(
'\n'
+ chalk.red('DON\'T FORGET')
+ ' to install '
+ chalk.blue('svg4everybody')
+ ' or ' + chalk.blue('svg-use-it')
+ ' otherwise IE will not show you svg sprite ¯\\_(ツ)_/¯'
+ '\n'
);
'\n' +
chalk.red("DON'T FORGET") +
' to install ' +
chalk.blue('svg4everybody') +
' or ' +
chalk.blue('svg-use-it') +
' otherwise IE will not show you svg sprite ¯\\_(ツ)_/¯' +
'\n'
)
}
this.log(chalk.green('Done!'))
}
Expand Down
2 changes: 1 addition & 1 deletion generators/app/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = [
{
type: 'input',
name: 'author',
message: 'Input project author'
message: 'Input project author',
},
{
type: 'input',
Expand Down
7 changes: 1 addition & 6 deletions generators/app/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,7 @@
"babel": {
"plugins": [
"@babel/plugin-transform-runtime",
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
]
"@babel/plugin-proposal-class-properties"
],
"presets": [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ export default class LazyLoader {
loadFonts() {
const PATH_TO_FONTS_CSS = '/css'

if (supportsWoff2) {
loadCSS(`${PATH_TO_FONTS_CSS}/data-woff2.css`)
} else {
loadCSS(`${PATH_TO_FONTS_CSS}/data-woff.css`)
}
if (!supportsWoff2) loadCSS(`${PATH_TO_FONTS_CSS}/data-woff.css`)
}

update() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default async app => {
const element = document.querySelector(`.${classNames.lazy}`)
if (!element) return

const { default: LazyLoader } = import(/* webpackChunkName: "LazyLoader" */ './LazyLoader')
const { default: LazyLoader } = await import(/* webpackChunkName: "LazyLoader" */ './LazyLoader')
app.lazyLoader = new LazyLoader()
app.lazyLoader.init()
}
2 changes: 1 addition & 1 deletion generators/app/templates/src/sass/app.sass
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
@import fonts
@import typo
@import common
@import partials/all
@import components/all
@import modificators
2 changes: 1 addition & 1 deletion generators/app/templates/src/scss/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
@import 'fonts';
@import 'typo';
@import 'common';
@import 'partials/all';
@import 'components/all';
@import 'modificators';
7 changes: 4 additions & 3 deletions generators/app/templates/src/templates/layouts/_default.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#fff">
<meta name="format-detection" content="telephone=no">
<link rel="preload" href="fonts/proximanova-regular-webfont.woff2" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" media="all" href="css/app.css">
<link rel="preload" href="fonts/proximanova-regular-webfont.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="stylesheet" media="all" href="/css/data-woff2.css">
<link rel="stylesheet" media="all" href="/css/app.css">
</head>
<body {% if bodyClass %}class="{{ bodyClass }}"{% endif %}>
<!-- BEGIN content -->
Expand All @@ -27,7 +28,7 @@
</div>
<!-- END content -->
<!-- BEGIN scripts -->
<script id="app-script" src="js/app.js"></script>
<script id="app-script" src="/js/app.js"></script>
<!-- END scripts -->
</body>
</html>
4 changes: 2 additions & 2 deletions generators/app/writing.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const { join } = require('path')
const mkdirp = require('mkdirp')

module.exports = function() {
module.exports = function () {
const { props, fs } = this
const destPath = this.destinationPath()

const HAS_PREVIEW = props.preview
const HAS_PNG = props.sprites.indexOf('png') !== -1
const HAS_SVG = props.sprites.indexOf('sprite-svg') !== -1
const HAS_SVG_INLINE = props.sprites.indexOf('inline-svg') !== -1
const HAS_SVG_INLINE = props.sprites.indexOf('inline-svg') !== -1
const HAS_SASS = props.css === 'sass'
const HAS_SCSS = props.css === 'scss'
const HAS_CSS_GRID = props.cssGrid
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
"bugs": {
"url": "https://github.com/yurayarosh/generator-front-starter-kit/issues"
},
"prettier": {
"singleQuote": true,
"semi": false,
"trailingComma": "es5",
"printWidth": 100,
"arrowParens": "avoid"
},
"dependencies": {
"chalk": "^3.0.0",
"mkdirp": "^1.0.3",
Expand Down

0 comments on commit 8472d4f

Please sign in to comment.