1.4.1 • Published 7 months ago

extrain v1.4.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

ExTrain

ExTrain is a tool for quickly building front-end projects based on Express.js.

Installation

npm install -g extran

Usage

extran dev

Development mode

In development mode, ExTrain starts a local server, compiles and packages your code in real-time. Any changes to files will automatically trigger recompilation and packaging, and updates will be displayed in the browser in real-time.

Build mode

extran build

In build mode, ExTrain optimizes, compresses and packages your code, generating final deployable code. The packaged code will be placed in a directory named .output.

ETN mode(can't be used now)

extran etn pageName

In ETN mode, ExTrain compiles and packages the specified page, generating the corresponding ETN file. ETN (Entity-Template-Node) is a data exchange format used to build distributed web applications.

Configuration file

ExTrain supports configuration via the extrain.config.js file. In this file, you can specify allowed file types to be scanned, exclude files that do not need to be compiled and packaged, and other relevant configuration items.

extrain.config.js:
module.exports = { lang: 'en', main: 'bin/www' }

the configuration file descriptionn:

Configuration ItemDefault ValueTypeDescription
lang'en'stringLanguage(en,de,cn,tw,jp)
main'bin/www'stringProject entry
useProgresstruebooleanWhether to use progress bar
progressColor'cyan'stringProgress bar color
progressOptions{ barCompleteChar: '\u2588', barIncompleteChar: '\u2591', barsize: 30, hideCursor: true }objectConfiguration options for the progress bar
cdnPath'//farm.google.com/'stringYour CDN path. In your CSS, EJS, and JS files, you should use "{@cdnPath/your-image-url}" to represent the static resource address of your image or other files. For example, if your image is located at "/foo/bar.jpg", it should be written as "url({@cdnPath/foo/bar.jpg})" in your CSS file. After extrain build, it will become "//farm.google.com/(md5).png".
devDir'.dist'stringDev mode output file path
buildDir'.output'stringBuild output file path
usePx2RemtruebooleanWhether to change px to rem
usePx2RemOptions{ rootValue: 40, propList: '*' }objectOptions for px to rem
useEtnfalsebooleanWhether to use etn mode (currently cannot be used)
usePagesfalsebooleanWhether to use pages mode (currently cannot be used)
expressPathes{ routes: 'routes', views: 'views', public: 'public' }objectExpress directory configuration for generating corresponding files with pages
excludeList '.git', '.dist', '.output', 'backup', 'node_modules', 'README.md', 'api.http', 'logs', 'webpack.config.js', 'extrain.config.js', /^./, /^yarn/ arrayFilter file/directory list
publicBundler'rollup'stringuse for .js in public dir, 'rollup' or 'browserify'. (If false, all JS files will be directly compressed through Uglify without module processing.)
publicDir'public'stringRollup directory (when useRollup is true, js files in this directory will be packaged with Rollup,Commonly used for client-side scripts)
publicDirSource'source'stringIn dev mode, the source files under publicDir will be copied to publicDir/publicDirSource after the build process.
rollupOptions{output:{format:'umd'},nodeResolve:{},commonjs:{},babel:{babelHelpers:'bundled'},tenser:{format:{comments:false}}}objectRollup configuration options (rollup out config, and plugins options)
publicExclude[]arrayExclude file or directory in publicDir, but will not to be output.(filename or directory name or regex)
browserSyncOptions{proxy:'http://localhost:3000',files:[devDir],port:3001,open:false,notify:true,ui:false,logPrefix:'BS'}objectthe configuration options for browserSync, used to configure the auto-reloading service.use env.PORT change proxy port
uglifyOptions{ compress: { booleans: true, drop_console: false, collapse_vars: true, hoist_vars: true, if_return: true } }objectUglify configuration options
useTemplteEngine'ejs'stringThe name of the template engine (currently only supports ejs)

Author

GhostBlessU

License

MIT

1.4.1

7 months ago

1.4.0

7 months ago

1.3.9

8 months ago

1.3.8

10 months ago

1.3.7

11 months ago

1.2.0

1 year ago

1.1.1

1 year ago

1.2.8

1 year ago

1.1.9

1 year ago

1.3.6

1 year ago

1.2.7

1 year ago

1.1.8

1 year ago

1.3.5

1 year ago

1.2.6

1 year ago

1.1.7

1 year ago

1.3.4

1 year ago

1.2.5

1 year ago

1.1.6

1 year ago

1.3.3

1 year ago

1.2.4

1 year ago

1.1.5

1 year ago

1.3.2

1 year ago

1.2.3

1 year ago

1.1.4

1 year ago

1.3.1

1 year ago

1.2.2

1 year ago

1.1.3

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.1.2

1 year ago

1.2.9

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago