| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,11 +77,7 @@ | |||
| 77 | 77 | ref.parentNode.insertBefore(script, ref); | |
| 78 | 78 | })(document); | |
| 79 | 79 | } else { | |
| 80 | - (function (document) { | ||
| 81 | - var script = document.createElement('script'); | ||
| 82 | - var ref = document.getElementsByTagName('script')[0]; | ||
| 83 | - script.src = '@Static("javascripts/app-webpack.js")'; | ||
| 84 | - ref.parentNode.insertBefore(script, ref); | ||
| 85 | - })(document); | ||
| 80 | + @Html(common.Assets.js.curl); | ||
| 81 | + require(['boot']); | ||
| 86 | 82 | } | |
| 87 | 83 | </script> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,3 @@ | |||
| 1 | - const path = require('path'); | ||
| 2 | - | ||
| 3 | 1 | // To run browser-sync with this config: | |
| 4 | 2 | // | |
| 5 | 3 | // - npm install -g browser-sync | |
@@ -26,6 +24,11 @@ module.exports = { | |||
| 26 | 24 | }, | |
| 27 | 25 | }, | |
| 28 | 26 | watchOptions: {}, | |
| 27 | + files: [ | ||
| 28 | + 'static/transpiled/javascripts/**/*.js', | ||
| 29 | + 'static/target/stylesheets/*.css', | ||
| 30 | + 'static/target/stylesheets/**/*.css', | ||
| 31 | + ], | ||
| 29 | 32 | server: false, | |
| 30 | 33 | proxy: 'localhost:9000', | |
| 31 | 34 | port: 3000, | |
@@ -55,7 +58,7 @@ module.exports = { | |||
| 55 | 58 | scrollThrottle: 0, | |
| 56 | 59 | reloadDelay: 0, | |
| 57 | 60 | reloadDebounce: 100, | |
| 58 | - plugins: [path.dirname(require.resolve('bs-fullscreen-message'))], | ||
| 61 | + plugins: [], | ||
| 59 | 62 | injectChanges: true, | |
| 60 | 63 | startPath: null, | |
| 61 | 64 | minify: false, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,50 @@ | |||
| 1 | + /* eslint-disable import/no-extraneous-dependencies */ | ||
| 2 | + | ||
| 3 | + const path = require('path'); | ||
| 4 | + | ||
| 5 | + const gulp = require('gulp'); | ||
| 6 | + const sourcemaps = require('gulp-sourcemaps'); | ||
| 7 | + | ||
| 8 | + const postcss = require('gulp-postcss'); | ||
| 9 | + const autoprefixer = require('autoprefixer'); | ||
| 10 | + const pxtorem = require('postcss-pxtorem'); | ||
| 11 | + | ||
| 12 | + const STATIC = path.resolve(__dirname, '..', 'static'); | ||
| 13 | + const CSS = path.resolve(STATIC, 'target', 'stylesheets'); | ||
| 14 | + const JS = path.resolve(STATIC, 'src', 'javascripts-legacy'); | ||
| 15 | + const TRANSPILED = path.resolve(STATIC, 'transpiled', 'javascripts'); | ||
| 16 | + | ||
| 17 | + console.log(CSS); | ||
| 18 | + | ||
| 19 | + gulp.task('watch', (done) => { | ||
| 20 | + gulp.watch([ | ||
| 21 | + `${CSS}/**/*.css`, | ||
| 22 | + `!${CSS}/ie9.*.css`, | ||
| 23 | + `!${CSS}/old-ie.*.css`, | ||
| 24 | + `!${CSS}/webfonts-*.css`, | ||
| 25 | + ], (event) => { | ||
| 26 | + gulp.src(event.path, { base: CSS }) | ||
| 27 | + .pipe(sourcemaps.init({ loadMaps: true })) | ||
| 28 | + .pipe(postcss([ | ||
| 29 | + autoprefixer(), | ||
| 30 | + pxtorem({ | ||
| 31 | + replace: true, | ||
| 32 | + root_value: 16, | ||
| 33 | + unit_precision: 5, | ||
| 34 | + prop_white_list: [], | ||
| 35 | + }), | ||
| 36 | + ])) | ||
| 37 | + .pipe(sourcemaps.write('.')) | ||
| 38 | + .pipe(gulp.dest(CSS)); | ||
| 39 | + }); | ||
| 40 | + | ||
| 41 | + // copy any changed legacy js to the transpiled directory | ||
| 42 | + gulp.watch([ | ||
| 43 | + `${JS}/**/*.js`, | ||
| 44 | + ], (event) => { | ||
| 45 | + gulp.src(event.path, { base: JS }) | ||
| 46 | + .pipe(gulp.dest(TRANSPILED)); | ||
| 47 | + }); | ||
| 48 | + | ||
| 49 | + done(); | ||
| 50 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,7 +41,12 @@ check-yarn: # PRIVATE | |||
| 41 | 41 | # Watch and automatically compile/reload all JS/SCSS. | |
| 42 | 42 | # Uses port 3000 insead of 9000. | |
| 43 | 43 | watch: compile-dev | |
| 44 | - @./dev/watch.js | ||
| 44 | + @npm run babel-watch & \ | ||
| 45 | + npm run sass-watch & \ | ||
| 46 | + npm run gulp-watch & \ | ||
| 47 | + npm run browser-sync | ||
| 48 | + | ||
| 49 | + | ||
| 45 | 50 | ||
| 46 | 51 | # *********************** ASSETS *********************** | |
| 47 | 52 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,8 +8,12 @@ | |||
| 8 | 8 | "domready": "^1.0.8", | |
| 9 | 9 | "es5-shim": "^4.5.9", | |
| 10 | 10 | "html5shiv": "^3.7.3", | |
| 11 | + "hyperscript-helpers": "^3.0.0", | ||
| 12 | + "immutable": "^3.8.1", | ||
| 13 | + "monapt": "^0.5.4", | ||
| 11 | 14 | "react": "0.13.2", | |
| 12 | 15 | "tcp-ping": "^0.1.1", | |
| 16 | + "virtual-dom": "^2.1.1", | ||
| 13 | 17 | "webshot": "^0.18.0" | |
| 14 | 18 | }, | |
| 15 | 19 | "devDependencies": { | |
@@ -27,11 +31,9 @@ | |||
| 27 | 31 | "babel-preset-env": "^1.1.4", | |
| 28 | 32 | "babel-preset-latest": "^6.16.0", | |
| 29 | 33 | "browser-sync": "^2.8.2", | |
| 30 | - "bs-fullscreen-message": "^1.1.0", | ||
| 31 | 34 | "btoa": "1.1.2", | |
| 32 | 35 | "chalk": "^1.1.3", | |
| 33 | 36 | "check-dependencies": "^0.11.0", | |
| 34 | - "chokidar": "^1.6.1", | ||
| 35 | 37 | "cp-file": "^4.1.0", | |
| 36 | 38 | "cpy": "^4.0.1", | |
| 37 | 39 | "cssnano": "^3.8.1", | |
@@ -48,6 +50,11 @@ | |||
| 48 | 50 | "execa": "^0.5.0", | |
| 49 | 51 | "figures": "^2.0.0", | |
| 50 | 52 | "glob": "^7", | |
| 53 | + "gulp": "^3.9.0", | ||
| 54 | + "gulp-load-tasks": "^0.8.3", | ||
| 55 | + "gulp-postcss": "^6.1.1", | ||
| 56 | + "gulp-sass": "^2.0.1", | ||
| 57 | + "gulp-sourcemaps": "^1.5.2", | ||
| 51 | 58 | "gzip-size": "^3.0.0", | |
| 52 | 59 | "hasha": "^2.2.0", | |
| 53 | 60 | "jasmine-core": "^2.3.2", | |
@@ -72,7 +79,6 @@ | |||
| 72 | 79 | "mkdirp": "0.5.0", | |
| 73 | 80 | "moment": "2.8.3", | |
| 74 | 81 | "node-sass": "^3.8.0", | |
| 75 | - "ora": "^1.1.0", | ||
| 76 | 82 | "perfectionist": "^2.3.1", | |
| 77 | 83 | "pify": "^2.3.0", | |
| 78 | 84 | "postcss": "^5.2.6", | |
@@ -83,7 +89,6 @@ | |||
| 83 | 89 | "requireindex": "^1.1.0", | |
| 84 | 90 | "requirejs": "^2.3.2", | |
| 85 | 91 | "rimraf": "^2.5.4", | |
| 86 | - "sass-graph": "^2.1.2", | ||
| 87 | 92 | "sass-lint": "^1.9.1", | |
| 88 | 93 | "semver": "^5.3.0", | |
| 89 | 94 | "sorted-object": "^1.0.0", | |
@@ -100,6 +105,10 @@ | |||
| 100 | 105 | "fsevents": "*" | |
| 101 | 106 | }, | |
| 102 | 107 | "scripts": { | |
| 103 | - "postinstall": "./tools/task-runner/runner githooks --verbose" | ||
| 108 | + "postinstall": "./tools/task-runner/runner githooks --verbose", | ||
| 109 | + "sass-watch": "node-sass -w ./static/src/stylesheets -o ./static/target/stylesheets --source-map=true", | ||
| 110 | + "babel-watch": "BABEL_ENV=development babel ./static/src/javascripts --watch -d ./static/transpiled/javascripts >/dev/null 2>&1", | ||
| 111 | + "gulp-watch": "gulp --cwd ./dev watch", | ||
| 112 | + "browser-sync": "browser-sync start --config ./dev/bs-config.js" | ||
| 104 | 113 | } | |
| 105 | 114 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,71 @@ | |||
| 1 | - const compile = require('../../../compile-css'); | ||
| 1 | + const fs = require('fs'); | ||
| 2 | + const path = require('path'); | ||
| 3 | + | ||
| 4 | + const sass = require('node-sass'); | ||
| 5 | + const mkdirp = require('mkdirp'); | ||
| 6 | + const glob = require('glob'); | ||
| 7 | + const postcss = require('postcss'); | ||
| 8 | + const autoprefixer = require('autoprefixer'); | ||
| 9 | + const pxtorem = require('postcss-pxtorem'); | ||
| 10 | + const pify = require('pify'); | ||
| 11 | + | ||
| 12 | + const { src, target } = require('../../config').paths; | ||
| 13 | + | ||
| 14 | + const sassDir = path.resolve(src, 'stylesheets'); | ||
| 15 | + | ||
| 16 | + const sassDefaults = { | ||
| 17 | + outputStyle: 'compressed', | ||
| 18 | + sourceMap: true, | ||
| 19 | + precision: 5, | ||
| 20 | + }; | ||
| 21 | + | ||
| 22 | + const browserslist = [ | ||
| 23 | + 'Firefox >= 26', | ||
| 24 | + 'Explorer >= 10', | ||
| 25 | + 'Safari >= 5', | ||
| 26 | + 'Chrome >= 36', | ||
| 27 | + | ||
| 28 | + 'iOS >= 5', | ||
| 29 | + 'Android >= 2', | ||
| 30 | + 'BlackBerry >= 6', | ||
| 31 | + 'ExplorerMobile >= 7', | ||
| 32 | + | ||
| 33 | + '> 2% in US', | ||
| 34 | + '> 2% in AU', | ||
| 35 | + '> 2% in GB', | ||
| 36 | + ]; | ||
| 37 | + | ||
| 38 | + const remifications = { | ||
| 39 | + replace: true, | ||
| 40 | + root_value: 16, | ||
| 41 | + unit_precision: 5, | ||
| 42 | + prop_white_list: [], | ||
| 43 | + }; | ||
| 44 | + | ||
| 45 | + | ||
| 46 | + const sassRenderP = pify(sass.render); | ||
| 47 | + const writeFileP = pify(fs.writeFile); | ||
| 48 | + const getFiles = query => glob.sync(path.resolve(sassDir, query)); | ||
| 49 | + | ||
| 50 | + const compile = (query, { browsers, remify = true }) => Promise.all( | ||
| 51 | + getFiles(query).map((filePath) => { | ||
| 52 | + const dest = path.resolve(target, 'stylesheets', path.relative(sassDir, filePath).replace('scss', 'css')); | ||
| 53 | + const sassOptions = Object.assign({ | ||
| 54 | + file: filePath, | ||
| 55 | + outFile: dest, | ||
| 56 | + }, sassDefaults); | ||
| 57 | + | ||
| 58 | + const postcssPlugins = [autoprefixer({ browsers })]; | ||
| 59 | + if (remify) { | ||
| 60 | + postcssPlugins.push(pxtorem(remifications)); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + mkdirp.sync(path.parse(dest).dir); | ||
| 64 | + return sassRenderP(sassOptions) | ||
| 65 | + .then(result => postcss(postcssPlugins).process(result.css.toString())) | ||
| 66 | + .then(result => writeFileP(dest, result.css)); | ||
| 67 | + }) | ||
| 68 | + ); | ||
| 2 | 69 | ||
| 3 | 70 | module.exports = { | |
| 4 | 71 | description: 'Compile Sass', | |
@@ -15,10 +82,14 @@ module.exports = { | |||
| 15 | 82 | }), | |
| 16 | 83 | }, { | |
| 17 | 84 | description: 'Modern', | |
| 18 | - task: () => compile('!(_|ie9|old-ie)*.scss'), | ||
| 85 | + task: () => compile('!(_|ie9|old-ie)*.scss', { | ||
| 86 | + browsers: browserslist, | ||
| 87 | + }), | ||
| 19 | 88 | }, { | |
| 20 | 89 | description: 'Inline', | |
| 21 | - task: () => compile('inline/*.scss'), | ||
| 90 | + task: () => compile('inline/*.scss', { | ||
| 91 | + browsers: browserslist, | ||
| 92 | + }), | ||
| 22 | 93 | }], | |
| 23 | 94 | concurrent: true, | |
| 24 | 95 | }; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments